mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Documents for tasks
This commit is contained in:
parent
4c08187bf1
commit
f1c5f37189
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Task;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
@ -22,14 +23,23 @@ class TaskTransformer extends EntityTransformer
|
||||
use MakesHash;
|
||||
|
||||
protected $defaultIncludes = [
|
||||
'documents'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $availableIncludes = [
|
||||
'documents'
|
||||
];
|
||||
|
||||
public function includeDocuments(Vendor $vendor)
|
||||
{
|
||||
$transformer = new DocumentTransformer($this->serializer);
|
||||
|
||||
return $this->includeCollection($task->documents, $transformer, Document::class);
|
||||
}
|
||||
|
||||
public function transform(Task $task)
|
||||
{
|
||||
return [
|
||||
|
@ -140,4 +140,18 @@ class DocumentsApiTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
// public function testTaskDocuments()
|
||||
// {
|
||||
|
||||
// $response = $this->withHeaders([
|
||||
// 'X-API-SECRET' => config('ninja.api_secret'),
|
||||
// 'X-API-TOKEN' => $this->token,
|
||||
// ])->get('/api/v1/tasks');
|
||||
|
||||
// $response->assertStatus(200);
|
||||
// $arr = $response->json();
|
||||
// $this->assertArrayHasKey('documents', $arr['data'][0]);
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user