12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Repositories\Transformers\Base;
- use Carbon\Carbon;
- use League\Fractal\TransformerAbstract;
- use App\Repositories\Models\Base\Role;
- /**
- * Class RoleTransformer.
- *
- * @package namespace App\Repositories\Transformers\Base;
- */
- class RoleTransformer extends TransformerAbstract
- {
- /**
- * Transform the Role entity.
- *
- * @param \App\Repositories\Models\Base\Role $model
- *
- * @return array
- */
- public function transform(Role $model)
- {
- return [
- 'id' => (int)$model->id,
- 'nickname' => $model->nickname,
- 'name' => $model->name,
- 'menus' => $model->menus,
- 'parent_menus' => $model->parent_menus,
- 'sort' => $model->sort,
- 'is_delete' => $model->is_delete,
- '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)
- ];
- }
- }
|