mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add tasks to transformer
This commit is contained in:
parent
781ecb34fc
commit
04300c830f
@ -15,6 +15,7 @@ namespace App\Transformers;
|
|||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use App\Models\Task;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,6 +34,7 @@ class ProjectTransformer extends EntityTransformer
|
|||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'client',
|
'client',
|
||||||
|
'tasks',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeDocuments(Project $project)
|
public function includeDocuments(Project $project)
|
||||||
@ -49,6 +51,13 @@ class ProjectTransformer extends EntityTransformer
|
|||||||
return $this->includeItem($project->client, $transformer, Client::class);
|
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)
|
public function transform(Project $project)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user