AttachTransformer.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Repositories\Transformers\Course;
  3. use App\Repositories\Models\Course\Attach;
  4. use Carbon\Carbon;
  5. use League\Fractal\TransformerAbstract;
  6. /**
  7. * Class CourseAttachTransformer.
  8. *
  9. * @package namespace App\Repositories\Transformers;
  10. */
  11. class AttachTransformer extends TransformerAbstract
  12. {
  13. /**
  14. * Transform the CourseAttach entity.
  15. *
  16. * @param \App\Repositories\Models\Course\Attach $model
  17. *
  18. * @return array
  19. */
  20. public function transform(Attach $model)
  21. {
  22. return [
  23. 'id' => (int)$model->id,
  24. // 'course_id' => (int)$model->course_id,
  25. // 'course_video_id' => (int)$model->course_video_id,
  26. // 'course_video' => $model->course_video,
  27. 'name' => $model->name,
  28. 'slug' => $model->slug,
  29. // 'path' => $model->path,
  30. 'path_resource' => $model->path_resource,
  31. // 'sort' => (int)$model->sort,
  32. // 'status' => (int)$model->status,
  33. 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
  34. 'humans' => $model->created_at->diffForHumans(),
  35. // 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
  36. ];
  37. }
  38. }