12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Repositories\Transformers\TCM;
- use App\Repositories\Models\TCM\Prescription;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\TCM\Drug;
- /**
- * Class DrugTransformer.
- *
- * @package namespace App\Repositories\Transformers\TCM;
- */
- class DrugTransformer extends TransformerAbstract
- {
- /**
- * Transform the Drug entity.
- *
- * @param \App\Repositories\Models\TCM\Drug $model
- *
- * @return array
- */
- public function transform(Drug $model)
- {
- return [
- 'id' => (int)$model->id,
- "name" => $model->name,
- "type" => $model->type,
- "type_text" => Prescription::$drugTypeMap[$model->type],
- "unit" => $model->unit,
- "area" => $model->area,
- "remark" => $model->remark,
- "letter" => $model->letter,
- "initial" => $model->initial,
- // "import_id" => $model->import_id,
- "sort" => $model->sort,
- // "commentable_id" => $model->commentable_id,
- // "commentable_type" => $model->commentable_type,
- "status" => $model->status,
- 'created_at' => $model->created_at,
- 'updated_at' => $model->updated_at
- ];
- }
- }
|