12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Repositories\Transformers\TCM;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\TCM\Patient;
- /**
- * Class PatientTransformer.
- *
- * @package namespace App\Repositories\Transformers\TCM;
- */
- class PatientTransformer extends TransformerAbstract
- {
- /**
- * Transform the Patient entity.
- *
- * @param \App\Repositories\Models\TCM\Patient $model
- *
- * @return array
- */
- public function transform(Patient $model)
- {
- return [
- 'id' => (int)$model->id,
- 'sex' => $model->sex,
- 'sex_text' => $model->sex_text,
- 'name' => $model->name,
- 'avatar' => $model->avatar,
- 'birth_date' => $model->birth_date,
- 'age' => $model->age,
- 'source' => $model->source,
- 'source_text' => $model->source_text,
- 'mobile' => $model->mobile,
- 'occupation' => $model->occupation,
- 'allergy' => $model->allergy,
- 'allergy_text' => $model->allergy_text,
- 'past_medical' => $model->past_medical,
- 'past_medical_text' => $model->past_medical_text,
- // 'hospital' => $model->hospital,
- 'lately_record' => $model->lately_record,
- 'visit_count' => $model->visit_count,
- '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)
- ];
- }
- }
|