123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Repositories\Transformers\Course;
- use App\Repositories\Models\Course\Attach;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- /**
- * Class CourseAttachTransformer.
- *
- * @package namespace App\Repositories\Transformers;
- */
- class AttachTransformer extends TransformerAbstract
- {
- /**
- * Transform the CourseAttach entity.
- *
- * @param \App\Repositories\Models\Course\Attach $model
- *
- * @return array
- */
- public function transform(Attach $model)
- {
- return [
- 'id' => (int)$model->id,
- 'course_id' => (int)$model->course_id,
- 'course_video_id' => (int)$model->course_video_id,
- 'course_video_name' => $model->course_video ? $model->course_video->title : '',
- 'name' => $model->name,
- 'path' => $model->path,
- 'path_resource' => $model->path_resource,
- 'sort' => (int)$model->sort,
- 'status' => (int)$model->status,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|