| @@ 11-60 (lines=50) @@ | ||
| 8 | use App\Modules\DummyModule\Http\Requests\InsertDummy; |
|
| 9 | use App\Modules\DummyModule\Http\Requests\UpdateDummy; |
|
| 10 | ||
| 11 | class DummyController extends BaseApiController |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * List of all route actions that the base api controller |
|
| 15 | * will skip permissions check for them. |
|
| 16 | * @var array |
|
| 17 | */ |
|
| 18 | protected $skipPermissionCheck = []; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * List of all route actions that the base api controller |
|
| 22 | * will skip login check for them. |
|
| 23 | * @var array |
|
| 24 | */ |
|
| 25 | protected $skipLoginCheck = []; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Init new object. |
|
| 29 | * |
|
| 30 | * @param DummyRepository $repo |
|
| 31 | * @param CoreConfig $config |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function __construct(DummyRepository $repo, CoreConfig $config) |
|
| 35 | { |
|
| 36 | parent::__construct($repo, $config, 'App\Modules\DummyModule\Http\Resources\DummyModel'); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Insert the given model to storage. |
|
| 41 | * |
|
| 42 | * @param InsertDummy $request |
|
| 43 | * @return \Illuminate\Http\Response |
|
| 44 | */ |
|
| 45 | public function insert(InsertDummy $request) |
|
| 46 | { |
|
| 47 | return new $this->modelResource($this->repo->save($request->all())); |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Update the given model to storage. |
|
| 52 | * |
|
| 53 | * @param UpdateDummy $request |
|
| 54 | * @return \Illuminate\Http\Response |
|
| 55 | */ |
|
| 56 | public function update(UpdateDummy $request) |
|
| 57 | { |
|
| 58 | return new $this->modelResource($this->repo->save($request->all())); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| @@ 11-60 (lines=50) @@ | ||
| 8 | use App\Modules\Roles\Http\Requests\InsertRole; |
|
| 9 | use App\Modules\Roles\Http\Requests\UpdateRole; |
|
| 10 | ||
| 11 | class RoleController extends BaseApiController |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * List of all route actions that the base api controller |
|
| 15 | * will skip permissions check for them. |
|
| 16 | * @var array |
|
| 17 | */ |
|
| 18 | protected $skipPermissionCheck = []; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * List of all route actions that the base api controller |
|
| 22 | * will skip login check for them. |
|
| 23 | * @var array |
|
| 24 | */ |
|
| 25 | protected $skipLoginCheck = []; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Init new object. |
|
| 29 | * |
|
| 30 | * @param RoleRepository $repo |
|
| 31 | * @param CoreConfig $config |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | public function __construct(RoleRepository $repo, CoreConfig $config) |
|
| 35 | { |
|
| 36 | parent::__construct($repo, $config, 'App\Modules\Roles\Http\Resources\Role'); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Insert the given model to storage. |
|
| 41 | * |
|
| 42 | * @param InsertRole $request |
|
| 43 | * @return \Illuminate\Http\Response |
|
| 44 | */ |
|
| 45 | public function insert(InsertRole $request) |
|
| 46 | { |
|
| 47 | return new $this->modelResource($this->repo->save($request->all())); |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Update the given model to storage. |
|
| 52 | * |
|
| 53 | * @param UpdateRole $request |
|
| 54 | * @return \Illuminate\Http\Response |
|
| 55 | */ |
|
| 56 | public function update(UpdateRole $request) |
|
| 57 | { |
|
| 58 | return new $this->modelResource($this->repo->save($request->all())); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||