123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Repositories\Transformers\Course;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Course\Organization;
- /**
- * Class OrganizationTransformer.
- *
- * @package namespace App\Repositories\Transformers\Course;
- */
- class OrganizationTransformer extends TransformerAbstract
- {
- /**
- * Transform the Organization entity.
- *
- * @param \App\Repositories\Models\Course\Organization $model
- *
- * @return array
- */
- public function transform(Organization $model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'coordinator' => $model->coordinator,
- 'cover_resource' => $model->cover_resource,
- 'tags' => $model->tags,
- 'intro' => $model->intro,
- 'slug' => $model->slug,
- 'course_nums' => $model->course_nums,
- 'student_nums' => $model->student_nums,
- 'is_issue' => $model->is_issue,
- 'is_member_status' => $model->is_member_status,
- 'status' => $model->status,
- /* place your other model properties here */
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'humans' => $model->created_at->diffForHumans(),
- ];
- }
- }
|