123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Repositories\Transformers\School;
- use App\Repositories\Transformers\BaseTransformer;
- use Carbon\Carbon;
- /**
- * Class StudentTransformer.
- *
- * @package namespace App\Repositories\Transformers\School;
- */
- class StudentTransformer extends BaseTransformer
- {
- /**
- * Transform the Student entity.
- *
- * @param \App\Repositories\Models\School\Student $model
- *
- * @return array
- */
- public function lists($model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'account' => $model->account,
- 'mobile' => $model->mobile,
- 'headimg' => $model->headimg,
- 'email' => $model->email,
- 'sex' => $model->sex,
- 'class' => $model->class,
- // 'intro' => $model->intro,
- 'is_register' => $model->is_register,
- 'admission_date' => $model->admission_date,
- 'year' => $model->year,
- 'status' => $model->status,
- '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,
- 'name' => $model->name,
- 'account' => $model->account,
- 'mobile' => $model->mobile,
- 'headimg' => $model->headimg,
- 'email' => $model->email,
- 'sex' => $model->sex,
- 'class' => $model->class,
- 'intro' => $model->intro,
- 'is_register' => $model->is_register,
- 'admission_date' => $model->admission_date,
- 'year' => $model->year,
- 'status' => $model->status,
- 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT),
- 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT)
- ];
- }
- }
|