@@ -33,8 +33,8 @@ |
||
| 33 | 33 | Cache::forget('excluded-action-list'); |
| 34 | 34 | Cache::forget('route-actions'); |
| 35 | 35 | $model = resolve('userModel'); |
| 36 | - $model->chunk(100, function ($users) { |
|
| 37 | - $users->each(function ($user) { |
|
| 36 | + $model->chunk(100, function($users) { |
|
| 37 | + $users->each(function($user) { |
|
| 38 | 38 | RemoveUserMenuCache::dispatch($user); |
| 39 | 39 | }); |
| 40 | 40 | }); |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | file_put_contents(app_path('Http/Kernel.php'), str_replace( |
| 61 | - "\\Illuminate\Auth\Middleware\Authorize::class,".PHP_EOL, |
|
| 62 | - "\\Illuminate\Auth\Middleware\Authorize::class,".PHP_EOL." 'menu' => \\PhpCollective\MenuMaker\Http\Middleware\VerifyMenuAuthorization::class,".PHP_EOL, |
|
| 61 | + "\\Illuminate\Auth\Middleware\Authorize::class," . PHP_EOL, |
|
| 62 | + "\\Illuminate\Auth\Middleware\Authorize::class," . PHP_EOL . " 'menu' => \\PhpCollective\MenuMaker\Http\Middleware\VerifyMenuAuthorization::class," . PHP_EOL, |
|
| 63 | 63 | $kernelFile |
| 64 | 64 | )); |
| 65 | 65 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function handle($request, Closure $next) |
| 17 | 17 | { |
| 18 | - if (! config('menu.enabled') |
|
| 18 | + if (!config('menu.enabled') |
|
| 19 | 19 | || is_excluded_route($request->route()) |
| 20 | 20 | || optional($request->user())->admin() |
| 21 | 21 | || optional($request->user())->authorize($request)) { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('is_excluded_route')) { |
|
| 3 | +if (!function_exists('is_excluded_route')) { |
|
| 4 | 4 | function is_excluded_route($route) |
| 5 | 5 | { |
| 6 | 6 | $namespaces = array_map('valid_namespace', config('menu.exclude.namespaces')); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if (! function_exists('is_working_route')) { |
|
| 29 | +if (!function_exists('is_working_route')) { |
|
| 30 | 30 | function is_working_route($route) |
| 31 | 31 | { |
| 32 | 32 | $namespaces = array_map('valid_namespace', config('menu.include.namespaces')); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -if (! function_exists('explode_route')) { |
|
| 56 | +if (!function_exists('explode_route')) { |
|
| 57 | 57 | function explode_route($route) |
| 58 | 58 | { |
| 59 | 59 | $actionName = $route->getActionName(); |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -if (! function_exists('valid_namespace')) { |
|
| 71 | +if (!function_exists('valid_namespace')) { |
|
| 72 | 72 | function valid_namespace($namespace) |
| 73 | 73 | { |
| 74 | 74 | return str_replace('\\', '\\\\', $namespace); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -if (! function_exists('unauthorized')) { |
|
| 78 | +if (!function_exists('unauthorized')) { |
|
| 79 | 79 | function unauthorized() |
| 80 | 80 | { |
| 81 | 81 | return response()->view('menu-maker::errors.401'); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function rules() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - 'name' => 'required|unique:pcmm_roles,name,'.$this->segment($this->segmentNo()), |
|
| 15 | + 'name' => 'required|unique:pcmm_roles,name,' . $this->segment($this->segmentNo()), |
|
| 16 | 16 | ]; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::name('menu-maker::')->group(function () { |
|
| 3 | +Route::name('menu-maker::')->group(function() { |
|
| 4 | 4 | Route::get('/', 'HomeController@index')->name('home'); |
| 5 | 5 | |
| 6 | 6 | Route::put('roles/assign', 'RoleController@assign')->name('roles.assign'); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function selected() { |
| 27 | 27 | |
| 28 | - if(request()->ajax()) |
|
| 28 | + if (request()->ajax()) |
|
| 29 | 29 | { |
| 30 | 30 | $menu_id = request('m_id'); |
| 31 | 31 | $selected = Menu::findOrFail($menu_id)->permissions()->select('namespace', 'controller', 'method', 'action')->get()->toArray(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $sections = Menu::sections()->pluck('name', 'id'); |
| 48 | 48 | |
| 49 | - if(! $sections->count()) |
|
| 49 | + if (!$sections->count()) |
|
| 50 | 50 | { |
| 51 | 51 | return redirect() |
| 52 | 52 | ->route('menu-maker::sections.index') |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $name = $menu->name; |
| 136 | 136 | |
| 137 | 137 | $childs = $menu->descendants()->count(); |
| 138 | - if($childs > 0) |
|
| 138 | + if ($childs > 0) |
|
| 139 | 139 | { |
| 140 | 140 | return redirect() |
| 141 | 141 | ->back() |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | $tree = Menu::descendantsOf($node)->toTree($node); |
| 159 | 159 | $selected = []; |
| 160 | - if(request()->has('g') && request('g') > 0) |
|
| 160 | + if (request()->has('g') && request('g') > 0) |
|
| 161 | 161 | { |
| 162 | 162 | $selected = Role::findOrFail(request('g'))->menus()->descendantsOf($node)->pluck('id')->toArray(); |
| 163 | 163 | } |
@@ -119,13 +119,13 @@ |
||
| 119 | 119 | { |
| 120 | 120 | $role = Role::findOrFail($request->role_id); |
| 121 | 121 | $previous_ids = $role->menus()->descendantsOf($request->section_id)->pluck('id')->toArray(); |
| 122 | - if(count($previous_ids) > 0) |
|
| 122 | + if (count($previous_ids) > 0) |
|
| 123 | 123 | { |
| 124 | 124 | $role->menus()->detach($previous_ids); |
| 125 | 125 | } |
| 126 | 126 | $role->menus()->attach($request->menu_ids); |
| 127 | 127 | |
| 128 | - $role->users->each(function ($user) { |
|
| 128 | + $role->users->each(function($user) { |
|
| 129 | 129 | RemoveUserMenuCache::dispatch($user); |
| 130 | 130 | }); |
| 131 | 131 | |