NavigationResource.php 624 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Http\Resources\CMS;
  11. use Illuminate\Http\Resources\Json\JsonResource;
  12. class NavigationResource extends JsonResource
  13. {
  14. public function toArray($request)
  15. {
  16. $model = $this;
  17. return [
  18. 'id' => (int)$model->id,
  19. 'user' => $model->name,
  20. 'link' => $model->link,
  21. 'is_single' => $model->is_single,
  22. ];
  23. }
  24. }