BannerResource.php 798 B

123456789101112131415161718192021222324252627282930
  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 App\Repositories\Enums\Base\BannerClickTypeEnum;
  12. use Illuminate\Http\Resources\Json\JsonResource;
  13. class BannerResource extends JsonResource
  14. {
  15. public function toArray($request)
  16. {
  17. return [
  18. 'id' => $this->id,
  19. 'name' => $this->name,
  20. 'click_type' => $this->click_type,
  21. 'click_type_text' => BannerClickTypeEnum::getDescription($this->click_type),
  22. 'click_body' => $this->click_body,
  23. 'cover_resource' => $this->cover_resource,
  24. ];
  25. }
  26. }