@@ -60,11 +60,11 @@ |
||
60 | 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, |
61 | 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
62 | 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
63 | - 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, |
|
64 | - 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, |
|
65 | - 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, |
|
66 | - 'jwt.verify' => \App\Http\Middleware\JwtMiddleware::class, |
|
67 | - ]; |
|
63 | + 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, |
|
64 | + 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, |
|
65 | + 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, |
|
66 | + 'jwt.verify' => \App\Http\Middleware\JwtMiddleware::class, |
|
67 | + ]; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * The priority-sorted list of middleware. |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - $this->middleware(function ($request, $next) { |
|
16 | - if(!auth()->user()->getRoleNames()->contains('super-admin')) |
|
15 | + $this->middleware(function($request, $next) { |
|
16 | + if (!auth()->user()->getRoleNames()->contains('super-admin')) |
|
17 | 17 | abort(403, 'Access denied'); |
18 | 18 | return $next($request); |
19 | 19 | }); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | { |
40 | 40 | return view('backend.roles.edit', [ |
41 | 41 | 'role' => $role, |
42 | - 'groupedPermissions' => Permission::all('name', 'id')->map(function ($perm) { |
|
42 | + 'groupedPermissions' => Permission::all('name', 'id')->map(function($perm) { |
|
43 | 43 | $perm->name = str_replace('_', ' ', $perm->name); |
44 | 44 | return $perm; |
45 | - })->groupBy(function ($perm) { |
|
45 | + })->groupBy(function($perm) { |
|
46 | 46 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
47 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
47 | + if (Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
48 | 48 | return Str::title(str_replace('_', ' ', $module)); |
49 | 49 | } |
50 | 50 | return "Others"; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | public function create() |
59 | 59 | { |
60 | 60 | return view('backend.roles.create', [ |
61 | - 'groupedPermissions' => Permission::all('name', 'id')->map(function ($perm) { |
|
61 | + 'groupedPermissions' => Permission::all('name', 'id')->map(function($perm) { |
|
62 | 62 | $perm->name = str_replace('_', ' ', $perm->name); |
63 | 63 | return $perm; |
64 | - })->groupBy(function ($perm) { |
|
64 | + })->groupBy(function($perm) { |
|
65 | 65 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
66 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
66 | + if (Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
67 | 67 | return Str::title(str_replace('_', ' ', $module)); |
68 | 68 | } |
69 | 69 | return "Others"; |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | public function __construct() |
14 | 14 | { |
15 | 15 | $this->middleware(function ($request, $next) { |
16 | - if(!auth()->user()->getRoleNames()->contains('super-admin')) |
|
17 | - abort(403, 'Access denied'); |
|
16 | + if(!auth()->user()->getRoleNames()->contains('super-admin')) { |
|
17 | + abort(403, 'Access denied'); |
|
18 | + } |
|
18 | 19 | return $next($request); |
19 | 20 | }); |
20 | 21 | |
@@ -44,8 +45,9 @@ discard block |
||
44 | 45 | return $perm; |
45 | 46 | })->groupBy(function ($perm) { |
46 | 47 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
47 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
48 | - return Str::title(str_replace('_', ' ', $module)); |
|
48 | + if(Str::contains($perm->name, str_replace('_', ' ', $module))) { |
|
49 | + return Str::title(str_replace('_', ' ', $module)); |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | return "Others"; |
51 | 53 | }), |
@@ -63,8 +65,9 @@ discard block |
||
63 | 65 | return $perm; |
64 | 66 | })->groupBy(function ($perm) { |
65 | 67 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
66 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
67 | - return Str::title(str_replace('_', ' ', $module)); |
|
68 | + if(Str::contains($perm->name, str_replace('_', ' ', $module))) { |
|
69 | + return Str::title(str_replace('_', ' ', $module)); |
|
70 | + } |
|
68 | 71 | } |
69 | 72 | return "Others"; |
70 | 73 | }), |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | */ |
77 | 80 | public function store(Request $request) |
78 | 81 | { |
79 | - if (!$request->name) |
|
80 | - return redirect()->back()->withErrors(['name' => 'Name cannot be empty.']); |
|
82 | + if (!$request->name) { |
|
83 | + return redirect()->back()->withErrors(['name' => 'Name cannot be empty.']); |
|
84 | + } |
|
81 | 85 | |
82 | 86 | $role = Role::create(['name' => $request->name]); |
83 | 87 | $role->permissions()->attach($request->permissions); |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | { |
109 | 109 | $messages = ['errors'=>[]]; |
110 | 110 | $filePath = $this->temp_path.$moduleName.'/'.$filename; |
111 | - $filenameToStore=$this->getFilenameToStore($filename); |
|
112 | - $fileToStore = $this->file_path.$moduleName.'/'. $filenameToStore; |
|
111 | + $filenameToStore = $this->getFilenameToStore($filename); |
|
112 | + $fileToStore = $this->file_path.$moduleName.'/'.$filenameToStore; |
|
113 | 113 | |
114 | 114 | try { |
115 | 115 | move_uploaded_file($filePath, $fileToStore); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | $messages = ['errors'=>[]]; |
130 | 130 | $filePath = $this->temp_path.$moduleName.'/'.$filename; |
131 | - $filenameToStore=$this->getFilenameToStore($filename); |
|
131 | + $filenameToStore = $this->getFilenameToStore($filename); |
|
132 | 132 | $img = Image::make($filePath); |
133 | 133 | $imgSize = $img->filesize(); |
134 | 134 |
@@ -194,8 +194,9 @@ |
||
194 | 194 | |
195 | 195 | protected function getPath($path) |
196 | 196 | { |
197 | - if (!is_dir($path)) |
|
198 | - mkdir($path, 0755, true); |
|
197 | + if (!is_dir($path)) { |
|
198 | + mkdir($path, 0755, true); |
|
199 | + } |
|
199 | 200 | |
200 | 201 | return $path; |
201 | 202 | } |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $data = new TypeResolver($this->name, $column, $typeOptions); |
46 | 46 | $type = $data->getLaragenType(); |
47 | 47 | $this->columnsData[$column] = $type; |
48 | - if($type->isDisplay()) |
|
48 | + if ($type->isDisplay()) |
|
49 | 49 | $this->displayColumns[] = $type; |
50 | 50 | } |
51 | 51 | |
52 | - if(sizeof($this->displayColumns)==0){ |
|
52 | + if (sizeof($this->displayColumns) == 0) { |
|
53 | 53 | $this->displayColumns[] = array_values($this->columnsData)[0]; |
54 | 54 | } |
55 | 55 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | public function getPivotalColumns() |
112 | 112 | { |
113 | 113 | $relativeTypes = []; |
114 | - foreach($this->columnsData as $type){ |
|
115 | - if($type->isRelational()&&$type->hasPivot()){ |
|
114 | + foreach ($this->columnsData as $type) { |
|
115 | + if ($type->isRelational() && $type->hasPivot()) { |
|
116 | 116 | $relativeTypes[] = $type; |
117 | 117 | } |
118 | 118 | } |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | { |
124 | 124 | $filteredTypes = []; |
125 | 125 | $options = is_array($options) ? $options : [$options]; |
126 | - foreach($this->columnsData as $type){ |
|
126 | + foreach ($this->columnsData as $type) { |
|
127 | 127 | foreach ($options as $option) { |
128 | - if($type->$option()){ |
|
128 | + if ($type->$option()) { |
|
129 | 129 | $filteredTypes[] = $columnsOnly ? $type->getColumn() : $type; |
130 | 130 | break; |
131 | 131 | } |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | public function getColumns($onlyNonRelational = false, $columnsOnly = false) |
138 | 138 | { |
139 | 139 | $columns = []; |
140 | - foreach($this->columnsData as $type){ |
|
141 | - if($onlyNonRelational && $type->isRelational()){ |
|
140 | + foreach ($this->columnsData as $type) { |
|
141 | + if ($onlyNonRelational && $type->isRelational()) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | - if($columnsOnly){ |
|
144 | + if ($columnsOnly) { |
|
145 | 145 | $columns[] = $type->getColumnKey(); |
146 | - }else{ |
|
146 | + } else { |
|
147 | 147 | $columns[$type->getColumnKey()] = $type; |
148 | 148 | } |
149 | 149 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | public function hasPivotRelations() |
159 | 159 | { |
160 | 160 | $hasRelations = false; |
161 | - foreach($this->columnsData as $column => $type){ |
|
162 | - if($type->isRelational()&&$type->hasPivot()){ |
|
161 | + foreach ($this->columnsData as $column => $type) { |
|
162 | + if ($type->isRelational() && $type->hasPivot()) { |
|
163 | 163 | $hasRelations = true; |
164 | 164 | break; |
165 | 165 | } |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | $data = new TypeResolver($this->name, $column, $typeOptions); |
46 | 46 | $type = $data->getLaragenType(); |
47 | 47 | $this->columnsData[$column] = $type; |
48 | - if($type->isDisplay()) |
|
49 | - $this->displayColumns[] = $type; |
|
48 | + if($type->isDisplay()) { |
|
49 | + $this->displayColumns[] = $type; |
|
50 | + } |
|
50 | 51 | } |
51 | 52 | |
52 | 53 | if(sizeof($this->displayColumns)==0){ |
@@ -143,7 +144,7 @@ discard block |
||
143 | 144 | } |
144 | 145 | if($columnsOnly){ |
145 | 146 | $columns[] = $type->getColumnKey(); |
146 | - }else{ |
|
147 | + } else{ |
|
147 | 148 | $columns[$type->getColumnKey()] = $type; |
148 | 149 | } |
149 | 150 | } |
@@ -12,12 +12,12 @@ |
||
12 | 12 | |
13 | 13 | if (is_dir($src)) { |
14 | 14 | $this->mirror($src, $dest."/".basename($src)); |
15 | - }else{ |
|
15 | + } else { |
|
16 | 16 | $this->copy($src, $dest); |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | - public function getFullSourcePath($path){ |
|
21 | - return realpath(__DIR__ . "/../resources/" . $path); |
|
20 | + public function getFullSourcePath($path) { |
|
21 | + return realpath(__DIR__."/../resources/".$path); |
|
22 | 22 | } |
23 | 23 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | if (is_dir($src)) { |
14 | 14 | $this->mirror($src, $dest."/".basename($src)); |
15 | - }else{ |
|
15 | + } else{ |
|
16 | 16 | $this->copy($src, $dest); |
17 | 17 | } |
18 | 18 | } |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | class FileType extends LaragenType |
5 | 5 | { |
6 | - protected $dataType = 'string'; |
|
7 | - protected $formType = 'file'; |
|
8 | - protected $extensions = '.png,.jpg,.gif,.bmp,.jpeg'; |
|
6 | + protected $dataType = 'string'; |
|
7 | + protected $formType = 'file'; |
|
8 | + protected $extensions = '.png,.jpg,.gif,.bmp,.jpeg'; |
|
9 | 9 | protected $relationalType = false; |
10 | 10 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class DateTimeType extends GeneralType |
6 | 6 | { |
7 | - protected $dataType = 'datetime'; |
|
8 | - protected $formType = 'datetime'; |
|
9 | - protected $size = false; |
|
10 | - protected $validationRule = 'date_format:Y-m-d H:i:s'; |
|
7 | + protected $dataType = 'datetime'; |
|
8 | + protected $formType = 'datetime'; |
|
9 | + protected $size = false; |
|
10 | + protected $validationRule = 'date_format:Y-m-d H:i:s'; |
|
11 | 11 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | class StringType extends GeneralType |
6 | 6 | { |
7 | - protected $dataType = 'string'; |
|
8 | - protected $formType = 'string'; |
|
7 | + protected $dataType = 'string'; |
|
8 | + protected $formType = 'string'; |
|
9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | class BooleanType extends GeneralType |
6 | 6 | { |
7 | - protected $dataType = 'boolean'; |
|
8 | - protected $formType = 'boolean'; |
|
7 | + protected $dataType = 'boolean'; |
|
8 | + protected $formType = 'boolean'; |
|
9 | 9 | } |