123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace App\Repositories\Transformers\Exam;
- use App\Repositories\Transformers\BaseTransformer;
- use Carbon\Carbon;
- /**
- * Class PaperTransformer.
- *
- * @package namespace App\Repositories\Transformers\Exam;
- */
- class PaperTransformer extends BaseTransformer
- {
- /**
- * Transform the Paper entity.
- *
- * @param \App\Repositories\Models\Exam\Paper $model
- *
- * @return array
- */
- public function lists($model)
- {
- return [
- 'id' => (int)$model->id,
- 'title' => $model->title,
- 'category' => $model->category,
- 'slug' => $model->slug,
- 'course' => $model->course,
- 'video' => $model->video,
- 'approved_count' => $model->approved_count,
- 'submit_count' => $model->submit_count,
- 'published_at' => $model->published_at,
- 'mark' => $model->mark,
- 'topic_nums' => $model->topic_nums,
- 'time' => $model->time,
- 'status' => $model->status,
- 'user' => $model->user,
- 'exam_status' => $model->exam_status,
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'humans' => $model->created_at->diffForHumans(),
- ];
- }
- public function detail($model)
- {
- return [
- 'id' => (int)$model->id,
- 'title' => $model->title,
- 'category' => $model->category,
- 'slug' => $model->slug,
- 'course' => $model->course,
- 'body' => $model->body,
- 'video' => $model->video,
- 'user' => $model->user,
- 'time' => $model->time,
- 'approved_count' => $model->approved_count,
- 'submit_count' => $model->submit_count,
- 'published_at' => $model->published_at,
- 'mark' => $model->mark,
- 'topic_nums' => $model->topic_nums,
- 'topics_lists' => $model->topic_lists,
- 'status' => $model->status,
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'humans' => $model->created_at->diffForHumans(),
- ];
- }
- }
|