@@ -5,8 +5,6 @@ |
||
5 | 5 | use App\Modules\Core\BaseClasses\BaseApiController; |
6 | 6 | use App\Modules\Roles\Services\RoleService; |
7 | 7 | use App\Modules\Roles\Http\Requests\AssignPermissions; |
8 | -use App\Modules\Roles\Http\Requests\InsertRole; |
|
9 | -use App\Modules\Roles\Http\Requests\UpdateRole; |
|
10 | 8 | |
11 | 9 | class RoleController extends BaseApiController |
12 | 10 | { |
@@ -10,40 +10,40 @@ |
||
10 | 10 | |
11 | 11 | class RoleController extends BaseApiController |
12 | 12 | { |
13 | - /** |
|
14 | - * Path of the sotre form request. |
|
15 | - * |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole'; |
|
13 | + /** |
|
14 | + * Path of the sotre form request. |
|
15 | + * |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + protected $storeFormRequest = 'App\Modules\Roles\Http\Requests\StoreRole'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Path of the model resource |
|
22 | - * |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - protected $modelResource = 'App\Modules\Roles\Http\Resources\Role'; |
|
20 | + /** |
|
21 | + * Path of the model resource |
|
22 | + * |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + protected $modelResource = 'App\Modules\Roles\Http\Resources\Role'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Init new object. |
|
29 | - * |
|
30 | - * @param RoleService $service |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function __construct(RoleService $service) |
|
34 | - { |
|
35 | - parent::__construct($service); |
|
36 | - } |
|
27 | + /** |
|
28 | + * Init new object. |
|
29 | + * |
|
30 | + * @param RoleService $service |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function __construct(RoleService $service) |
|
34 | + { |
|
35 | + parent::__construct($service); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Handle an assign permissions to role request. |
|
40 | - * |
|
41 | - * @param AssignPermissions $request |
|
42 | - * @param integer $id |
|
43 | - * @return \Illuminate\Http\Response |
|
44 | - */ |
|
45 | - public function assignPermissions(AssignPermissions $request, $id) |
|
46 | - { |
|
47 | - return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids'))); |
|
48 | - } |
|
38 | + /** |
|
39 | + * Handle an assign permissions to role request. |
|
40 | + * |
|
41 | + * @param AssignPermissions $request |
|
42 | + * @param integer $id |
|
43 | + * @return \Illuminate\Http\Response |
|
44 | + */ |
|
45 | + public function assignPermissions(AssignPermissions $request, $id) |
|
46 | + { |
|
47 | + return new $this->modelResource($this->service->assignPermissions($id, $request->get('permission_ids'))); |
|
48 | + } |
|
49 | 49 | } |
@@ -6,58 +6,58 @@ |
||
6 | 6 | |
7 | 7 | class OauthClientsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to oauthClients table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * OauthClients model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'oauthClient', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'show', |
|
32 | - 'model' => 'oauthClient', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'store', |
|
38 | - 'model' => 'oauthClient', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'update', |
|
44 | - 'model' => 'oauthClient', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'revoke', |
|
50 | - 'model' => 'oauthClient', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'unRevoke', |
|
56 | - 'model' => 'oauthClient', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - ] |
|
61 | - ); |
|
62 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to oauthClients table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * OauthClients model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'oauthClient', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'show', |
|
32 | + 'model' => 'oauthClient', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'store', |
|
38 | + 'model' => 'oauthClient', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'update', |
|
44 | + 'model' => 'oauthClient', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'revoke', |
|
50 | + 'model' => 'oauthClient', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'unRevoke', |
|
56 | + 'model' => 'oauthClient', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + ] |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -8,50 +8,50 @@ |
||
8 | 8 | |
9 | 9 | class OauthClientController extends BaseApiController |
10 | 10 | { |
11 | - /** |
|
12 | - * Path of the sotre form request. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $storeFormRequest = 'App\Modules\OauthClients\Http\Requests\StoreOauthClient'; |
|
11 | + /** |
|
12 | + * Path of the sotre form request. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $storeFormRequest = 'App\Modules\OauthClients\Http\Requests\StoreOauthClient'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Path of the model resource |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $modelResource = 'App\Modules\OauthClients\Http\Resources\OauthClient'; |
|
18 | + /** |
|
19 | + * Path of the model resource |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $modelResource = 'App\Modules\OauthClients\Http\Resources\OauthClient'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Init new object. |
|
27 | - * |
|
28 | - * @param OauthClientService $service |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function __construct(OauthClientService $service) |
|
32 | - { |
|
33 | - parent::__construct($service); |
|
34 | - } |
|
25 | + /** |
|
26 | + * Init new object. |
|
27 | + * |
|
28 | + * @param OauthClientService $service |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function __construct(OauthClientService $service) |
|
32 | + { |
|
33 | + parent::__construct($service); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Revoke the given client. |
|
38 | - * |
|
39 | - * @param integer $clientId Id of the client |
|
40 | - * @return \Illuminate\Http\Response |
|
41 | - */ |
|
42 | - public function revoke($clientId) |
|
43 | - { |
|
44 | - return new GeneralResource($this->service->revoke($clientId)); |
|
45 | - } |
|
36 | + /** |
|
37 | + * Revoke the given client. |
|
38 | + * |
|
39 | + * @param integer $clientId Id of the client |
|
40 | + * @return \Illuminate\Http\Response |
|
41 | + */ |
|
42 | + public function revoke($clientId) |
|
43 | + { |
|
44 | + return new GeneralResource($this->service->revoke($clientId)); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Un revoke the given client. |
|
49 | - * |
|
50 | - * @param integer $clientId Id of the client |
|
51 | - * @return \Illuminate\Http\Response |
|
52 | - */ |
|
53 | - public function unRevoke($clientId) |
|
54 | - { |
|
55 | - return new GeneralResource($this->service->unRevoke($clientId)); |
|
56 | - } |
|
47 | + /** |
|
48 | + * Un revoke the given client. |
|
49 | + * |
|
50 | + * @param integer $clientId Id of the client |
|
51 | + * @return \Illuminate\Http\Response |
|
52 | + */ |
|
53 | + public function unRevoke($clientId) |
|
54 | + { |
|
55 | + return new GeneralResource($this->service->unRevoke($clientId)); |
|
56 | + } |
|
57 | 57 | } |
@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class StoreOauthClient extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'name' => 'required|max:255', |
|
28 | - 'redirect' => 'required|url', |
|
29 | - 'user_id' => 'required|exists:users,id', |
|
30 | - 'revoked' => 'boolean' |
|
31 | - ]; |
|
32 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'name' => 'required|max:255', |
|
28 | + 'redirect' => 'required|url', |
|
29 | + 'user_id' => 'required|exists:users,id', |
|
30 | + 'revoked' => 'boolean' |
|
31 | + ]; |
|
32 | + } |
|
33 | 33 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | Route::group(['prefix' => 'oauth/clients'], function () { |
15 | 15 | |
16 | - Route::get('/', 'OauthClientController@index'); |
|
17 | - Route::get('{id}', 'OauthClientController@show'); |
|
18 | - Route::post('/', 'OauthClientController@store'); |
|
19 | - Route::patch('{id}', 'OauthClientController@update'); |
|
20 | - Route::delete('{id}', 'OauthClientController@destroy'); |
|
21 | - Route::patch('{id}/revoke', 'OauthClientController@revoke'); |
|
22 | - Route::patch('{id}/unrevoke', 'OauthClientController@unRevoke'); |
|
16 | + Route::get('/', 'OauthClientController@index'); |
|
17 | + Route::get('{id}', 'OauthClientController@show'); |
|
18 | + Route::post('/', 'OauthClientController@store'); |
|
19 | + Route::patch('{id}', 'OauthClientController@update'); |
|
20 | + Route::delete('{id}', 'OauthClientController@destroy'); |
|
21 | + Route::patch('{id}/revoke', 'OauthClientController@revoke'); |
|
22 | + Route::patch('{id}/unrevoke', 'OauthClientController@unRevoke'); |
|
23 | 23 | }); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'oauth/clients'], function () { |
|
14 | +Route::group(['prefix' => 'oauth/clients'], function() { |
|
15 | 15 | |
16 | 16 | Route::get('/', 'OauthClientController@index'); |
17 | 17 | Route::get('{id}', 'OauthClientController@show'); |
@@ -6,34 +6,34 @@ |
||
6 | 6 | |
7 | 7 | class PermissionsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to permissions table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Permissions model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'permission', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'show', |
|
32 | - 'model' => 'permission', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - ] |
|
37 | - ); |
|
38 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to permissions table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Permissions model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'permission', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'show', |
|
32 | + 'model' => 'permission', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + ] |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | |
16 | 16 | Route::group(['prefix' => 'permissions'], function () { |
17 | 17 | |
18 | - Route::get('/', 'PermissionController@index'); |
|
19 | - Route::get('/{id}', 'PermissionController@show'); |
|
18 | + Route::get('/', 'PermissionController@index'); |
|
19 | + Route::get('/{id}', 'PermissionController@show'); |
|
20 | 20 | }); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'permissions'], function () { |
|
16 | +Route::group(['prefix' => 'permissions'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'PermissionController@index'); |
19 | 19 | Route::get('/{id}', 'PermissionController@show'); |
@@ -6,46 +6,46 @@ |
||
6 | 6 | |
7 | 7 | class NotificationsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to settings table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * notifications model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'notification', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'unread', |
|
32 | - 'model' => 'notification', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'markAsRead', |
|
38 | - 'model' => 'notification', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'markAllAsRead', |
|
44 | - 'model' => 'notification', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ] |
|
48 | - ] |
|
49 | - ); |
|
50 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to settings table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * notifications model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'notification', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'unread', |
|
32 | + 'model' => 'notification', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'markAsRead', |
|
38 | + 'model' => 'notification', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'markAllAsRead', |
|
44 | + 'model' => 'notification', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ] |
|
48 | + ] |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | |
14 | 14 | Route::group(['prefix' => 'notifications'], function () { |
15 | 15 | |
16 | - Route::get('/', 'NotificationController@index'); |
|
17 | - Route::get('unread', 'NotificationController@unread'); |
|
18 | - Route::patch('{id}/read', 'NotificationController@markAsRead'); |
|
19 | - Route::patch('read/all', 'NotificationController@markAllAsRead'); |
|
16 | + Route::get('/', 'NotificationController@index'); |
|
17 | + Route::get('unread', 'NotificationController@unread'); |
|
18 | + Route::patch('{id}/read', 'NotificationController@markAsRead'); |
|
19 | + Route::patch('read/all', 'NotificationController@markAllAsRead'); |
|
20 | 20 | }); |