1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Add tasks to transformer

This commit is contained in:
Benjamin Beganović 2023-06-15 14:43:51 +02:00
parent 781ecb34fc
commit 04300c830f

View File

@ -15,6 +15,7 @@ namespace App\Transformers;
use App\Models\Client;
use App\Models\Document;
use App\Models\Project;
use App\Models\Task;
use App\Utils\Traits\MakesHash;
/**
@ -33,6 +34,7 @@ class ProjectTransformer extends EntityTransformer
*/
protected $availableIncludes = [
'client',
'tasks',
];
public function includeDocuments(Project $project)
@ -49,6 +51,13 @@ class ProjectTransformer extends EntityTransformer
return $this->includeItem($project->client, $transformer, Client::class);
}
public function includeTasks(Project $project): \League\Fractal\Resource\Collection
{
$transformer = new TaskTransformer($this->serializer);
return $this->includeCollection($project->tasks, $transformer, Task::class);
}
public function transform(Project $project)
{
return [