12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace App\Repositories\Transformers\Exam;
- use App\Repositories\Transformers\BaseTransformer;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Exam\PaperResult;
- /**
- * Class PaperResultTransformer.
- *
- * @package namespace App\Repositories\Transformers\Exam;
- */
- class PaperResultTransformer extends BaseTransformer
- {
- /**
- * Transform the PaperResult entity.
- *
- * @param \App\Repositories\Models\Exam\PaperResult $model
- *
- * @return array
- */
- public function lists($model)
- {
- return [
- 'id' => (int)$model->id,
- 'day' => $model->day,
- 'paper' => $model->paper,
- 'assign_admin' => $model->assign_admin,
- 'polling_admin' => $model->polling_admin,
- // 'result' => $model->result,
- 'mark' => $model->mark,
- 'total_mak' => $model->total_mak,
- 'is_answer' => $model->is_answer,
- 'answer_at' => $model->answer_at,
- 'is_exist_danger' => $model->is_exist_danger,
- 'imgs' => $model->imgs,
- 'remark' => $model->remark,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- public function detail($model)
- {
- return [
- 'id' => (int)$model->id,
- 'day' => $model->day,
- 'paper' => $model->paper,
- 'topics' => $model->paper->topics,
- 'assign_admin' => $model->assign_admin,
- 'polling_admin' => $model->polling_admin,
- 'result' => $model->result,
- 'mark' => $model->mark,
- 'total_mak' => $model->total_mak,
- 'is_answer' => $model->is_answer,
- 'answer_at' => $model->answer_at,
- 'is_exist_danger' => $model->is_exist_danger,
- 'imgs' => $model->imgs,
- 'img_uels' => $model->img_urls,
- 'remark' => $model->remark,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|