AdminHashtag.php 887 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class AdminHashtag extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
  11. */
  12. public function toArray($request)
  13. {
  14. return [
  15. 'id' => $this->id,
  16. 'name' => $this->name,
  17. 'slug' => $this->slug,
  18. 'can_trend' => $this->can_trend === null ? true : (bool) $this->can_trend,
  19. 'can_search' => $this->can_search === null ? true : (bool) $this->can_search,
  20. 'is_nsfw' => (bool) $this->is_nsfw,
  21. 'is_banned' => (bool) $this->is_banned,
  22. 'cached_count' => $this->cached_count ?? 0,
  23. 'created_at' => $this->created_at
  24. ];
  25. }
  26. }