Passed
Push — master ( 5ce6e6...66283a )
by Al Amin
06:42
created
resources/views/menus/tree.blade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2
-$traverse = function ($menus) use (&$traverse, $selected) {
2
+$traverse = function($menus) use (&$traverse, $selected) {
3 3
     foreach ($menus as $menu) {
4 4
         echo $menu->ancestors->count() ? '<ul>' : '';
5 5
         echo '<li> ';
6
-        if (! $menu->children->count()) {
6
+        if (!$menu->children->count()) {
7 7
             $checked = '';
8 8
             if (in_array($menu->id, $selected)) {
9 9
                 $checked = 'checked';
Please login to merge, or discard this patch.
src/MenuItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         foreach ($attributes as $key => $value)
27 27
         {
28
-            if(property_exists($this, $key))
28
+            if (property_exists($this, $key))
29 29
             {
30 30
                 $this->{$key} = $value;
31 31
             }
Please login to merge, or discard this patch.
src/MenuMaker.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $this->section = Menu::whereAlease($alease)->first();
28 28
 
29
-        if (! $this->section) {
29
+        if (!$this->section) {
30 30
             return collect([]);
31 31
         }
32 32
         return $this->getMenuItemsWithActive();
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
         $currentPath = request()->path();
40 40
         $menus = $this->getMenuItems();
41 41
 
42
-        $traverse = function ($menus) use (&$traverse, $currentRoute, $currentPath) {
42
+        $traverse = function($menus) use (&$traverse, $currentRoute, $currentPath) {
43 43
             $checked = collect([]);
44 44
             foreach ($menus as $key => $menu) {
45 45
                 $menu['children'] = $traverse($menu['children'], $currentRoute, $currentPath);
46
-                if((is_array($menu['routes']) && in_array($currentRoute, $menu['routes']))
46
+                if ((is_array($menu['routes']) && in_array($currentRoute, $menu['routes']))
47 47
                     || $currentPath === $menu['link']
48 48
                     || $menu['children']->where('active', true)->count())
49 49
                 {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     protected function getMenuItems()
62 62
     {
63
-        return Cache::rememberForever('menus.section.' . optional($this->section)->id . '.user.' . $this->id, function () {
63
+        return Cache::rememberForever('menus.section.' . optional($this->section)->id . '.user.' . $this->id, function() {
64 64
             return $this->admin()
65 65
                 ? $this->getAdminMenuItems()
66 66
                 : $this->getUserMenuItems();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     private function getAdminMenuItems()
71 71
     {
72 72
         $this->section->load([
73
-            'descendants' => function ($query) {
73
+            'descendants' => function($query) {
74 74
                 $query->visible();
75 75
             }
76 76
         ]);
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     private function getUserMenuItems()
82 82
     {
83 83
         $this->section->load([
84
-            'descendants' => function ($query) {
84
+            'descendants' => function($query) {
85 85
                 $query->with([
86
-                    'ancestors' => function ($query) {
86
+                    'ancestors' => function($query) {
87 87
                         $query->descendantsOf($this->section);
88 88
                     }
89 89
                 ])->select('pcmm_menus.*')
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
                     ->leftJoin('pcmm_role_user', 'pcmm_roles.id', '=', 'pcmm_role_user.role_id')
93 93
                     ->leftJoin($this->getTable(), 'pcmm_role_user.user_id', '=', $this->getTable() . '.id')
94 94
                     ->visible()
95
-                    ->where(function ($query) {
95
+                    ->where(function($query) {
96 96
                         $query->wherePrivilege('PUBLIC')
97
-                            ->orWhere(function ($query) {
97
+                            ->orWhere(function($query) {
98 98
                                 $query->where('pcmm_menus.privilege', 'PROTECTED')
99 99
                                     ->where('pcmm_roles.is_active', true)
100 100
                                     ->where($this->getTable() . '.id', $this->id);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             }
104 104
         ]);
105 105
 
106
-        $items = $this->section->descendants->reject(function ($item) {
106
+        $items = $this->section->descendants->reject(function($item) {
107 107
             return $item->ancestors->contains('privilege', 'PRIVATE')
108 108
                 || $item->ancestors->contains('visible', false);
109 109
         });
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     public function approve($alease)
199 199
     {
200
-        return $this->admin() || $this->whereHas('roles.menus', function ($query) use ($alease) {
200
+        return $this->admin() || $this->whereHas('roles.menus', function($query) use ($alease) {
201 201
                 $query->whereAlease($alease);
202 202
             })->exists();
203 203
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     public function authorize($request)
206 206
     {
207 207
         $route = explode_route($request->route());
208
-        return $this->whereHas('roles.menus.permissions', function ($query) use ($route) {
208
+        return $this->whereHas('roles.menus.permissions', function($query) use ($route) {
209 209
             $query->where('namespace', $route['namespace'])
210 210
                 ->where('controller', $route['controller'])
211 211
                 ->where('method', $route['method'])
Please login to merge, or discard this patch.
src/Storage/Role.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@
 block discarded – undo
63 63
     {
64 64
         parent::boot();
65 65
 
66
-        static::saved(function ($group) {
67
-            if($group->is_admin)
66
+        static::saved(function($group) {
67
+            if ($group->is_admin)
68 68
             {
69 69
                 static::where('is_admin', true)
70 70
                     ->where('id', '!=', $group->id)
Please login to merge, or discard this patch.
src/Storage/Menu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         parent::boot();
93 93
 
94
-        static::creating(function ($menu) {
94
+        static::creating(function($menu) {
95 95
             $menu->position = self::position($menu->parent_id);
96 96
         });
97 97
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         (new static)->ofCommonStrategicObjective($commonStrategicObjectiveId)
108 108
             ->get()
109
-            ->each(function ($objective, $key) {
109
+            ->each(function($objective, $key) {
110 110
                 $objective->sequence = $key + 1;
111 111
                 $objective->save();
112 112
             });
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
     public function getRouteListAttribute()
139 139
     {
140
-        if (! $this->routes) {
140
+        if (!$this->routes) {
141 141
             return $this->routes;
142 142
         }
143 143
         return implode(', ', $this->routes);
Please login to merge, or discard this patch.
src/Storage/Permission.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 
60 60
     public static function routes()
61 61
     {
62
-        return Cache::remember('routes', now()->addHour(), function () {
62
+        return Cache::remember('routes', now()->addHour(), function() {
63 63
             $filterRoutes = [];
64 64
             $routes = Route::getRoutes();
65 65
             foreach ($routes as $route) {
66
-                if (! self::routeMatch($route)) {
66
+                if (!self::routeMatch($route)) {
67 67
                     continue;
68 68
                 }
69 69
                 $filterRoutes[] = explode_route($route);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public static function excludedActionList()
76 76
     {
77
-        return Cache::rememberForever('excluded-action-list', function () {
77
+        return Cache::rememberForever('excluded-action-list', function() {
78 78
             $excluded = collect();
79 79
             $routes = Route::getRoutes();
80 80
             foreach ($routes as $route) {
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
     public static function actions()
90 90
     {
91
-        return Cache::rememberForever('route-actions', function () {
91
+        return Cache::rememberForever('route-actions', function() {
92 92
             $actions = [];
93
-            self::routes()->each(function ($route) use (&$actions) {
93
+            self::routes()->each(function($route) use (&$actions) {
94 94
                 $actions[$route['namespace']][$route['controller']][$route['method']][] = $route['action'];
95 95
             });
96 96
             ksort($actions);
@@ -100,6 +100,6 @@  discard block
 block discarded – undo
100 100
 
101 101
     private static function routeMatch($route)
102 102
     {
103
-        return is_working_route($route) && ! is_excluded_route($route);
103
+        return is_working_route($route) && !is_excluded_route($route);
104 104
     }
105 105
 }
Please login to merge, or discard this patch.
src/Storage/seeds/PcmmMenusTableSeeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function run()
14 14
     {
15
-        $this->data()->each(function ($data) {
15
+        $this->data()->each(function($data) {
16 16
             Menu::create($data);
17 17
         });
18 18
     }
Please login to merge, or discard this patch.
src/Storage/seeds/PermissionsTableSeeder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
      */
14 14
     public function run()
15 15
     {
16
-        Menu::where('parent_id', '>', 0)->get()->each(function ($menu){
17
-            $menu->permissions()->saveMany(factory(Permission::class, mt_rand(1,5))->make());
16
+        Menu::where('parent_id', '>', 0)->get()->each(function($menu) {
17
+            $menu->permissions()->saveMany(factory(Permission::class, mt_rand(1, 5))->make());
18 18
         });
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/Storage/factories/PermissionFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use PhpCollective\MenuMaker\Storage\Permission;
16 16
 
17
-$factory->define(Permission::class, function () {
17
+$factory->define(Permission::class, function() {
18 18
     $permission = Permission::routes()->random();
19 19
     return [
20 20
         'namespace'  => $permission['namespace'],
Please login to merge, or discard this patch.