/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Http/Fixtures/PostResourceWithOptionalRelationship.php
18 строк
523 B
Aaron Huisinga
StyleCI fixes
01 окт 2017, 23:55
01 окт 2017, 23:55
32efb56
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Http\Fixtures; class PostResourceWithOptionalRelationship extends PostResource { public function toArray($request) { return [ 'id' => $this->id, 'comments' => new CommentCollection($this->whenLoaded('comments')), 'author' => new AuthorResource($this->whenLoaded('author')), 'author_name' => $this->whenLoaded('author', function () { return $this->author->name; }), ]; } }