Passed
Push — main ( ea673e...f0dc91 )
by PRATIK
18:35 queued 15:13
created
src/Providers/AdmineticServiceProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     protected function registerRoutes()
170 170
     {
171
-        Route::group($this->routeConfiguration(), function () {
171
+        Route::group($this->routeConfiguration(), function() {
172 172
             $this->loadRoutesFrom(__DIR__.'/../../routes/web.php');
173 173
         });
174 174
     }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     protected function directives()
214 214
     {
215
-        Blade::if('hasRole', function ($roles) {
215
+        Blade::if ('hasRole', function($roles) {
216 216
             $hasAccess = false;
217 217
             $roles_array = explode('|', $roles);
218 218
             foreach ($roles_array as $role) {
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 
222 222
             return $hasAccess;
223 223
         });
224
-        Blade::if('preference', function ($preference_name, $default_value) {
224
+        Blade::if ('preference', function($preference_name, $default_value) {
225 225
             return preference($preference_name, $default_value);
226 226
         });
227
-        Blade::directive('setting', function ($setting_name) {
227
+        Blade::directive('setting', function($setting_name) {
228 228
             return "<?php echo setting($setting_name) ?>";
229 229
         });
230 230
     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      */
302 302
     protected function getFacades()
303 303
     {
304
-        $this->app->bind('adminetic', function ($app) {
304
+        $this->app->bind('adminetic', function($app) {
305 305
             return new Adminetic();
306 306
         });
307 307
     }
Please login to merge, or discard this patch.
src/Helpers/AdminHelper.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Support\Str;
6 6
 use Pratiksh\Adminetic\Models\Admin\Setting;
7 7
 
8
-if (! function_exists('spa')) {
8
+if (!function_exists('spa')) {
9 9
     function spa()
10 10
     {
11 11
         return setting('spa', config('adminetic.spa', true));
12 12
     }
13 13
 }
14 14
 
15
-if (! function_exists('getClassesList')) {
15
+if (!function_exists('getClassesList')) {
16 16
     function getClassesList($dir)
17 17
     {
18 18
         $classes = \File::allFiles($dir);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         return $classes;
28 28
     }
29 29
 }
30
-if (! function_exists('getAllModelNames')) {
30
+if (!function_exists('getAllModelNames')) {
31 31
     function getAllModelNames($dir)
32 32
     {
33 33
         $modelNames = [];
@@ -41,35 +41,35 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-if (! function_exists('validImageFolder')) {
44
+if (!function_exists('validImageFolder')) {
45 45
     function validImageFolder($name, $default = 'default')
46 46
     {
47 47
         return strtolower(str_replace([' ', '-', '$', '<', '>', '&', '{', '*', '\\', '/', ':', '.', ';', ',', "'", '"'], '_', $name ?? trim($default)));
48 48
     }
49 49
 }
50 50
 
51
-if (! function_exists('getImagePlaceholder')) {
51
+if (!function_exists('getImagePlaceholder')) {
52 52
     function getImagePlaceholder()
53 53
     {
54 54
         return asset(config('adminetic.default_image_placeholder', 'adminetic/static/placeholder.png'));
55 55
     }
56 56
 }
57 57
 
58
-if (! function_exists('getVerticalImagePlaceholder')) {
58
+if (!function_exists('getVerticalImagePlaceholder')) {
59 59
     function getVerticalImagePlaceholder()
60 60
     {
61 61
         return asset(config('adminetic.vertical_image_placeholder', 'adminetic/static/vertical_placeholder.jpg'));
62 62
     }
63 63
 }
64 64
 
65
-if (! function_exists('getSliderPlaceholder')) {
65
+if (!function_exists('getSliderPlaceholder')) {
66 66
     function getSliderPlaceholder()
67 67
     {
68 68
         return asset(config('adminetic.slider_placeholder', 'adminetic/static/slider.jpg'));
69 69
     }
70 70
 }
71 71
 
72
-if (! function_exists('getProfilePlaceholder')) {
72
+if (!function_exists('getProfilePlaceholder')) {
73 73
     function getProfilePlaceholder($p = null)
74 74
     {
75 75
         $profile = $p ?? Auth::user()->profile ?? Auth::user()->profile()->create();
@@ -78,100 +78,100 @@  discard block
 block discarded – undo
78 78
     }
79 79
 }
80 80
 
81
-if (! function_exists('title')) {
81
+if (!function_exists('title')) {
82 82
     function title()
83 83
     {
84 84
         return setting('title', config('adminetic.name', 'Adminetic'));
85 85
     }
86 86
 }
87 87
 
88
-if (! function_exists('description')) {
88
+if (!function_exists('description')) {
89 89
     function description($default = null)
90 90
     {
91 91
         return setting('description', config('adminetic.description', $default ?? 'Adminetic Admin Panel'));
92 92
     }
93 93
 }
94 94
 
95
-if (! function_exists('keywords')) {
95
+if (!function_exists('keywords')) {
96 96
     function keywords()
97 97
     {
98 98
         return setting('keywords', config('adminetic.keywords', 'adminetic admin panel, adminetic, pratik shrestha, doctype innovations'));
99 99
     }
100 100
 }
101 101
 
102
-if (! function_exists('loader_enabled')) {
102
+if (!function_exists('loader_enabled')) {
103 103
     function loader_enabled()
104 104
     {
105 105
         return setting('loader_enabled', config('adminetic.loader_enabled', true));
106 106
     }
107 107
 }
108 108
 
109
-if (! function_exists('favicon')) {
109
+if (!function_exists('favicon')) {
110 110
     function favicon()
111 111
     {
112
-        return getImg(! is_null(setting('favicon')) ? setting('favicon', config('adminetic.favicon', 'adminetic/static/favicon.png')) : config('adminetic.favicon', 'adminetic/static/favicon.png'), config('adminetic.favicon', 'adminetic/static/favicon.png'));
112
+        return getImg(!is_null(setting('favicon')) ? setting('favicon', config('adminetic.favicon', 'adminetic/static/favicon.png')) : config('adminetic.favicon', 'adminetic/static/favicon.png'), config('adminetic.favicon', 'adminetic/static/favicon.png'));
113 113
     }
114 114
 }
115 115
 
116
-if (! function_exists('logo')) {
116
+if (!function_exists('logo')) {
117 117
     function logo()
118 118
     {
119
-        return getImg(! is_null(setting('logo')) ? setting('logo', config('adminetic.logo', 'adminetic/static/logo.png')) : config('adminetic.logo', 'adminetic/static/logo.png'), config('adminetic.logo', 'adminetic/static/logo.png'));
119
+        return getImg(!is_null(setting('logo')) ? setting('logo', config('adminetic.logo', 'adminetic/static/logo.png')) : config('adminetic.logo', 'adminetic/static/logo.png'), config('adminetic.logo', 'adminetic/static/logo.png'));
120 120
     }
121 121
 }
122 122
 
123
-if (! function_exists('dark_logo')) {
123
+if (!function_exists('dark_logo')) {
124 124
     function dark_logo()
125 125
     {
126
-        return getImg(! is_null(setting('dark_logo')) ? setting('dark_logo', config('adminetic.dark_logo', 'adminetic/static/dark_logo.png')) : config('adminetic.dark_logo', 'adminetic/static/dark_logo.png'), config('adminetic.dark_logo', 'adminetic/static/dark_logo.png'));
126
+        return getImg(!is_null(setting('dark_logo')) ? setting('dark_logo', config('adminetic.dark_logo', 'adminetic/static/dark_logo.png')) : config('adminetic.dark_logo', 'adminetic/static/dark_logo.png'), config('adminetic.dark_logo', 'adminetic/static/dark_logo.png'));
127 127
     }
128 128
 }
129 129
 
130
-if (! function_exists('logoBanner')) {
130
+if (!function_exists('logoBanner')) {
131 131
     function logoBanner()
132 132
     {
133
-        return getImg(! is_null(setting('logo_banner')) ? setting('logo_banner', config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg')) : config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg'), config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg'));
133
+        return getImg(!is_null(setting('logo_banner')) ? setting('logo_banner', config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg')) : config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg'), config('adminetic.logo_banner', 'adminetic/static/logo_banner.jpg'));
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('login_register_bg_image')) {
137
+if (!function_exists('login_register_bg_image')) {
138 138
     function login_register_bg_image()
139 139
     {
140
-        return getImg(! is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image', config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg')) : config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg'), config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg'));
140
+        return getImg(!is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image', config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg')) : config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg'), config('adminetic.login_register_bg_img', 'adminetic/static/login_register_bg_img.jpg'));
141 141
     }
142 142
 }
143 143
 
144
-if (! function_exists('getLazyLoadImg')) {
144
+if (!function_exists('getLazyLoadImg')) {
145 145
     function getLazyLoadImg()
146 146
     {
147 147
         return asset('adminetic/static/loader.svg');
148 148
     }
149 149
 }
150 150
 
151
-if (! function_exists('random_color_part')) {
151
+if (!function_exists('random_color_part')) {
152 152
     function random_color_part()
153 153
     {
154 154
         return str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT);
155 155
     }
156 156
 }
157 157
 
158
-if (! function_exists('random_color')) {
158
+if (!function_exists('random_color')) {
159 159
     function random_color()
160 160
     {
161 161
         return random_color_part().random_color_part().random_color_part();
162 162
     }
163 163
 }
164 164
 
165
-if (! function_exists('setting')) {
165
+if (!function_exists('setting')) {
166 166
     function setting($setting_name, $default = null)
167 167
     {
168 168
         $valid_setting_name = strtolower(str_replace(' ', '_', $setting_name));
169 169
         $settings = Cache::has('settings') ?
170 170
             Cache::get('settings')
171
-            : Cache::rememberForever('settings', function () {
171
+            : Cache::rememberForever('settings', function() {
172 172
                 return Setting::all();
173 173
             });
174
-        $setting = $settings->first(function ($s) use ($valid_setting_name) {
174
+        $setting = $settings->first(function($s) use ($valid_setting_name) {
175 175
             return $s->getRawOriginal('setting_name') == $valid_setting_name;
176 176
         });
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 }
181 181
 
182
-if (! function_exists('preference')) {
182
+if (!function_exists('preference')) {
183 183
     function preference($preference_name, bool $default = null)
184 184
     {
185 185
         $valid_preference_name = strtolower(str_replace(' ', '_', $preference_name));
@@ -193,39 +193,39 @@  discard block
 block discarded – undo
193 193
     }
194 194
 }
195 195
 
196
-if (! function_exists('deleteImage')) {
196
+if (!function_exists('deleteImage')) {
197 197
     function deleteImage($image)
198 198
     {
199 199
         $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : '';
200 200
     }
201 201
 }
202 202
 
203
-if (! function_exists('api_paginate_limit')) {
203
+if (!function_exists('api_paginate_limit')) {
204 204
     function api_paginate_limit($default = null)
205 205
     {
206 206
         return setting('api_paginate_limit', $default ?? config('adminetic.api_paginate_limit', 10));
207 207
     }
208 208
 }
209 209
 
210
-if (! function_exists('api_collection_return_paginate')) {
210
+if (!function_exists('api_collection_return_paginate')) {
211 211
     function api_collection_return_paginate()
212 212
     {
213 213
         return setting('api_collection_return_paginate', config('adminetic.api_collection_return_paginate', true));
214 214
     }
215 215
 }
216 216
 
217
-if (! function_exists('darkMode')) {
217
+if (!function_exists('darkMode')) {
218 218
     function darkMode()
219 219
     {
220 220
         return setting('dark_mode', config('adminetic.dark_mode', false));
221 221
     }
222 222
 }
223 223
 
224
-if (! function_exists('getCondition')) {
224
+if (!function_exists('getCondition')) {
225 225
     function getCondition($conditions)
226 226
     {
227 227
         $result = null;
228
-        if (! isset($conditions)) {
228
+        if (!isset($conditions)) {
229 229
             return false;
230 230
         }
231 231
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     }
252 252
 }
253 253
 
254
-if (! function_exists('getImg')) {
254
+if (!function_exists('getImg')) {
255 255
     function getImg($img, $default)
256 256
     {
257 257
         if (isset($img)) {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 }
270 270
 
271
-if (! function_exists('putContentToClassFunction')) {
271
+if (!function_exists('putContentToClassFunction')) {
272 272
     function putContentToClassFunction($file, $function_name, $data, $closing_token = '}')
273 273
     {
274 274
         $data = $data."\n";
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     }
304 304
 }
305 305
 
306
-if (! function_exists('checkIfFieldIsRequired')) {
306
+if (!function_exists('checkIfFieldIsRequired')) {
307 307
     function checkIfFieldIsRequired($table_name, $field)
308 308
     {
309 309
         $isNullable = null;
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if (! function_exists('label')) {
323
+if (!function_exists('label')) {
324 324
     function label($table, $field, $default_label = null)
325 325
     {
326 326
         $display_name = $default_label ?? Str::ucfirst(str_replace('_', ' ', $field));
327
-        if (! checkIfFieldIsRequired($table, $field)) {
327
+        if (!checkIfFieldIsRequired($table, $field)) {
328 328
             // do something if phone_number is nullable
329 329
             echo "{$display_name} <span class='text-danger'>*</span>";
330 330
         } else {
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
     }
334 334
 }
335 335
 
336
-if (! function_exists('role_theme')) {
336
+if (!function_exists('role_theme')) {
337 337
     function role_theme()
338 338
     {
339 339
         $role = auth()->check() ? auth()->user()->roles->first()->name : null;
340 340
         $role_theme = config('adminetic.role_theme', null);
341
-        if (! is_null($role_theme)) {
341
+        if (!is_null($role_theme)) {
342 342
             return isset($role_theme[$role]) ? $role_theme[$role] : 'compact-sidebar';
343 343
         }
344 344
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     }
347 347
 }
348 348
 
349
-if (! function_exists('setEnvValue')) {
349
+if (!function_exists('setEnvValue')) {
350 350
     function setEnvValue(array $values)
351 351
     {
352 352
         $envFile = app()->environmentFilePath();
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 $oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition);
361 361
 
362 362
                 // If key does not exist, add it
363
-                if (! $keyPosition || ! $endOfLinePosition || ! $oldLine) {
363
+                if (!$keyPosition || !$endOfLinePosition || !$oldLine) {
364 364
                     $str .= "{$envKey}={$envValue}\n";
365 365
                 } else {
366 366
                     $str = str_replace($oldLine, "{$envKey}={$envValue}", $str);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         }
370 370
 
371 371
         $str = substr($str, 0, -1);
372
-        if (! file_put_contents($envFile, $str)) {
372
+        if (!file_put_contents($envFile, $str)) {
373 373
             return false;
374 374
         }
375 375
 
Please login to merge, or discard this patch.