mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
Merge branch 'production' of https://bitbucket.org/studiotem/jandl-taskmanager-app into production
This commit is contained in:
commit
d70a5a9d93
2 files changed
+27
-2
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Resources\MasterTaskResource;
|
use App\Http\Resources\MasterTaskResource;
|
||||||
|
use App\Http\Resources\MasterTaskSimpleResource;
|
||||||
use App\Models\Attachment;
|
use App\Models\Attachment;
|
||||||
use App\Models\MasterTask;
|
use App\Models\MasterTask;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -48,7 +49,7 @@ class MasterTaskController extends Controller
|
|||||||
|
|
||||||
// vracia vsetky mastertasky v jednoduchom formate pre potreby dropdownu na FE (problem bol dlhy load time na zaciatku appky)
|
// vracia vsetky mastertasky v jednoduchom formate pre potreby dropdownu na FE (problem bol dlhy load time na zaciatku appky)
|
||||||
case 'simple':
|
case 'simple':
|
||||||
$mastertasks = MasterTask::select('id', 'title');
|
$mastertasks = MasterTask::select('id', 'title', 'project_id', 'color');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -60,7 +61,7 @@ class MasterTaskController extends Controller
|
|||||||
$mastertasks = $mastertasks->get();
|
$mastertasks = $mastertasks->get();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'mastertasks' => (isset($parameters['simple'])) ? $mastertasks : MasterTaskResource::collection($mastertasks)
|
'mastertasks' => (isset($parameters['simple'])) ? MasterTaskSimpleResource::collection($mastertasks) : MasterTaskResource::collection($mastertasks)
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class MasterTaskSimpleResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'name' => $this->title,
|
||||||
|
'project_code' => ($this->project) ? $this->project->code . ' ' . $this->project->name : null,
|
||||||
|
'color' => $this->color,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user