12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Repositories\Transformers\Base;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Base\Setting;
- /**
- * Class SettingTransformer.
- *
- * @package namespace App\Repositories\Transformers\Base;
- */
- class SettingTransformer extends TransformerAbstract
- {
- /**
- * Transform the Setting entity.
- *
- * @param \App\Repositories\Models\Base\Setting $model
- *
- * @return array
- */
- public function transform(Setting $model)
- {
- return [
- 'id' => (int)$model->id,
- 'name' => $model->name,
- 'type' => $model->type,
- 'parent_id' => $model->parent_id,
- 'parent_name' => $model->parent ? $model->parent->name : '',
- 'sort' => $model->sort,
- 'value' => $model->value,
- 'is_init' => $model->is_init,
- '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)
- ];
- }
- }
|