Completed
Push — master ( da99d4...871ace )
by Roberts
13s queued 10s
created
src/Providers/ArboryServiceProvider.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         $this->registerValidationRules();
71 71
         $this->registerAssets();
72 72
 
73
-        $this->app->singleton( SecurityStrategy::class, function()
73
+        $this->app->singleton(SecurityStrategy::class, function()
74 74
         {
75
-            return $this->app->make( SessionSecurityService::class );
75
+            return $this->app->make(SessionSecurityService::class);
76 76
         } );
77 77
 
78
-        $this->loadTranslationsFrom( __DIR__ . '/resources/lang', 'arbory' );
78
+        $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'arbory');
79 79
     }
80 80
 
81 81
     /**
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
      */
84 84
     private function registerServiceProviders()
85 85
     {
86
-        $this->app->register( ArboryTranslationServiceProvider::class );
87
-        $this->app->register( TranslatableServiceProvider::class );
88
-        $this->app->register( ArboryFileServiceProvider::class );
89
-        $this->app->register( ArboryAuthServiceProvider::class );
90
-        $this->app->register( GlideImageServiceProvider::class );
91
-        $this->app->register( AssetServiceProvider::class );
92
-        $this->app->register( SettingsServiceProvider::class );
93
-        $this->app->register( ExcelServiceProvider::class );
94
-        $this->app->register( FileManagerServiceProvider::class );
86
+        $this->app->register(ArboryTranslationServiceProvider::class);
87
+        $this->app->register(TranslatableServiceProvider::class);
88
+        $this->app->register(ArboryFileServiceProvider::class);
89
+        $this->app->register(ArboryAuthServiceProvider::class);
90
+        $this->app->register(GlideImageServiceProvider::class);
91
+        $this->app->register(AssetServiceProvider::class);
92
+        $this->app->register(SettingsServiceProvider::class);
93
+        $this->app->register(ExcelServiceProvider::class);
94
+        $this->app->register(FileManagerServiceProvider::class);
95 95
     }
96 96
 
97 97
     /**
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
     {
102 102
         $aliasLoader = AliasLoader::getInstance();
103 103
 //        $aliasLoader->alias( 'TranslationCache', \Waavi\Translation\Facades\TranslationCache::class );
104
-        $aliasLoader->alias( 'Activation', \Cartalyst\Sentinel\Laravel\Facades\Activation::class );
105
-        $aliasLoader->alias( 'Reminder', \Cartalyst\Sentinel\Laravel\Facades\Reminder::class );
106
-        $aliasLoader->alias( 'Sentinel', \Cartalyst\Sentinel\Laravel\Facades\Sentinel::class );
107
-        $aliasLoader->alias( 'GlideImage', \Roboc\Glide\Support\Facades\GlideImage::class );
108
-        $aliasLoader->alias( 'Excel', \Maatwebsite\Excel\Facades\Excel::class );
104
+        $aliasLoader->alias('Activation', \Cartalyst\Sentinel\Laravel\Facades\Activation::class);
105
+        $aliasLoader->alias('Reminder', \Cartalyst\Sentinel\Laravel\Facades\Reminder::class);
106
+        $aliasLoader->alias('Sentinel', \Cartalyst\Sentinel\Laravel\Facades\Sentinel::class);
107
+        $aliasLoader->alias('GlideImage', \Roboc\Glide\Support\Facades\GlideImage::class);
108
+        $aliasLoader->alias('Excel', \Maatwebsite\Excel\Facades\Excel::class);
109 109
     }
110 110
 
111 111
     /**
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $configFilename = __DIR__ . '/../../config/arbory.php';
117 117
 
118
-        $this->mergeConfigFrom( $configFilename, 'arbory' );
118
+        $this->mergeConfigFrom($configFilename, 'arbory');
119 119
 
120
-        $this->publishes( [
121
-            $configFilename => config_path( 'arbory.php' )
122
-        ], 'config' );
120
+        $this->publishes([
121
+            $configFilename => config_path('arbory.php')
122
+        ], 'config');
123 123
 
124
-        $this->publishes( [
125
-            __DIR__ . '/../../stubs/settings.stub' => config_path( 'settings.php' )
126
-        ], 'config' );
124
+        $this->publishes([
125
+            __DIR__ . '/../../stubs/settings.stub' => config_path('settings.php')
126
+        ], 'config');
127 127
 
128
-        $this->publishes( [
129
-            __DIR__ . '/../../stubs/admin_routes.stub' => base_path( '/routes/admin.php' )
130
-        ], 'config' );
128
+        $this->publishes([
129
+            __DIR__ . '/../../stubs/admin_routes.stub' => base_path('/routes/admin.php')
130
+        ], 'config');
131 131
 
132 132
         $this->publishes([
133 133
             __DIR__ . '/../../resources/lang/' => base_path('resources/lang/vendor/arbory')
134 134
         ], 'lang');
135 135
 
136
-        $this->loadMigrationsFrom( __DIR__ . '/../../database/migrations' );
137
-        $this->loadViewsFrom( __DIR__ . '/../../resources/views', 'arbory' );
136
+        $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
137
+        $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'arbory');
138 138
     }
139 139
 
140 140
     /**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
          */
148 148
         $router = $this->app[ 'router' ];
149 149
 
150
-        $router->middlewareGroup( 'admin', [
150
+        $router->middlewareGroup('admin', [
151 151
             \App\Http\Middleware\EncryptCookies::class,
152 152
             \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
153 153
             \Illuminate\Session\Middleware\StartSession::class,
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
             \App\Http\Middleware\VerifyCsrfToken::class,
156 156
             \Illuminate\Routing\Middleware\SubstituteBindings::class,
157 157
             ArboryAdminHasAllowedIpMiddleware::class
158
-        ] );
158
+        ]);
159 159
 
160
-        $router->aliasMiddleware( 'arbory.admin_auth', ArboryAdminAuthMiddleware::class );
161
-        $router->aliasMiddleware( 'arbory.admin_module_access', ArboryAdminModuleAccessMiddleware::class );
162
-        $router->aliasMiddleware( 'arbory.admin_quest', ArboryAdminGuestMiddleware::class );
163
-        $router->aliasMiddleware( 'arbory.admin_in_role', ArboryAdminInRoleMiddleware::class );
164
-        $router->aliasMiddleware( 'arbory.admin_has_access', ArboryAdminHasAccessMiddleware::class );
165
-        $router->aliasMiddleware( 'arbory.route_redirect', ArboryRouteRedirectMiddleware::class );
166
-        $router->aliasMiddleware( 'arbory.admin_has_allowed_ip', ArboryAdminHasAllowedIpMiddleware::class );
160
+        $router->aliasMiddleware('arbory.admin_auth', ArboryAdminAuthMiddleware::class);
161
+        $router->aliasMiddleware('arbory.admin_module_access', ArboryAdminModuleAccessMiddleware::class);
162
+        $router->aliasMiddleware('arbory.admin_quest', ArboryAdminGuestMiddleware::class);
163
+        $router->aliasMiddleware('arbory.admin_in_role', ArboryAdminInRoleMiddleware::class);
164
+        $router->aliasMiddleware('arbory.admin_has_access', ArboryAdminHasAccessMiddleware::class);
165
+        $router->aliasMiddleware('arbory.route_redirect', ArboryRouteRedirectMiddleware::class);
166
+        $router->aliasMiddleware('arbory.admin_has_allowed_ip', ArboryAdminHasAllowedIpMiddleware::class);
167 167
 
168
-        $this->app->booted( function( $app )
168
+        $this->app->booted(function($app)
169 169
         {
170
-            $app[ Kernel::class ]->prependMiddleware( ArboryRouteRedirectMiddleware::class );
170
+            $app[ Kernel::class ]->prependMiddleware(ArboryRouteRedirectMiddleware::class);
171 171
         } );
172 172
 
173 173
         $this->registerAdminRoutes();
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 
177 177
     private function registerAdminRoutes()
178 178
     {
179
-        $this->app['router']->group( [
179
+        $this->app[ 'router' ]->group([
180 180
             'as' => 'admin.',
181 181
             'middleware' => 'admin',
182 182
             'namespace' => '\Arbory\Base\Http\Controllers',
183
-            'prefix' => config( 'arbory.uri' )
184
-        ], function ()
183
+            'prefix' => config('arbory.uri')
184
+        ], function()
185 185
         {
186 186
             include __DIR__ . '/../../routes/admin.php';
187 187
         } );
@@ -189,19 +189,19 @@  discard block
 block discarded – undo
189 189
 
190 190
     private function registerAppRoutes()
191 191
     {
192
-        $adminRoutes = base_path( 'routes/admin.php' );
192
+        $adminRoutes = base_path('routes/admin.php');
193 193
 
194
-        if( !File::exists( $adminRoutes ) )
194
+        if (!File::exists($adminRoutes))
195 195
         {
196 196
             return;
197 197
         }
198 198
 
199
-        $this->app['router']->group( [
199
+        $this->app[ 'router' ]->group([
200 200
             'as' => 'admin.',
201 201
             'middleware' => [ 'admin', 'arbory.admin_auth' ],
202 202
             'namespace' => '',
203
-            'prefix' => config( 'arbory.uri' )
204
-        ],function () use ($adminRoutes)
203
+            'prefix' => config('arbory.uri')
204
+        ], function() use ($adminRoutes)
205 205
         {
206 206
             include $adminRoutes;
207 207
         } );
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
             'arbory.generate' => GenerateCommand::class
220 220
         ];
221 221
 
222
-        foreach( $commands as $containerKey => $commandClass )
222
+        foreach ($commands as $containerKey => $commandClass)
223 223
         {
224
-            $this->registerCommand( $containerKey, $commandClass );
224
+            $this->registerCommand($containerKey, $commandClass);
225 225
         }
226 226
     }
227 227
 
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
      * @param string $commandClass
231 231
      * @return void
232 232
      */
233
-    private function registerCommand( string $containerKey, string $commandClass )
233
+    private function registerCommand(string $containerKey, string $commandClass)
234 234
     {
235
-        $this->app->singleton( $containerKey, function () use ( $commandClass )
235
+        $this->app->singleton($containerKey, function() use ($commandClass)
236 236
         {
237
-            return $this->app->make( $commandClass );
237
+            return $this->app->make($commandClass);
238 238
         } );
239 239
 
240
-        $this->commands( $containerKey );
240
+        $this->commands($containerKey);
241 241
     }
242 242
 
243 243
     /**
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
      */
246 246
     private function registerModuleRegistry()
247 247
     {
248
-        $this->app->singleton( 'arbory', function ()
248
+        $this->app->singleton('arbory', function()
249 249
         {
250 250
             return new Admin(
251
-                $this->app['sentinel'],
251
+                $this->app[ 'sentinel' ],
252 252
                 new Menu(),
253 253
                 new AssetPipeline()
254 254
             );
255 255
         } );
256 256
 
257
-        $this->app->singleton( Admin::class, function ()
257
+        $this->app->singleton(Admin::class, function()
258 258
         {
259
-            return $this->app['arbory'];
259
+            return $this->app[ 'arbory' ];
260 260
         } );
261 261
     }
262 262
 
@@ -265,20 +265,20 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function registerFields()
267 267
     {
268
-        $this->app->singleton( FieldTypeRegistry::class, function ( Application $app )
268
+        $this->app->singleton(FieldTypeRegistry::class, function(Application $app)
269 269
         {
270 270
             $fieldTypeRegistry = new FieldTypeRegistry();
271 271
 
272
-            $fieldTypeRegistry->registerByType( 'integer', Hidden::class, 'int' );
273
-            $fieldTypeRegistry->registerByType( 'string', Text::class, 'string' );
274
-            $fieldTypeRegistry->registerByType( 'text', Textarea::class, 'string' );
275
-            $fieldTypeRegistry->registerByType( 'longtext', Richtext::class, 'string' );
276
-            $fieldTypeRegistry->registerByType( 'datetime', DateTime::class, 'string' );
277
-            $fieldTypeRegistry->registerByType( 'boolean', Checkbox::class, 'bool' );
272
+            $fieldTypeRegistry->registerByType('integer', Hidden::class, 'int');
273
+            $fieldTypeRegistry->registerByType('string', Text::class, 'string');
274
+            $fieldTypeRegistry->registerByType('text', Textarea::class, 'string');
275
+            $fieldTypeRegistry->registerByType('longtext', Richtext::class, 'string');
276
+            $fieldTypeRegistry->registerByType('datetime', DateTime::class, 'string');
277
+            $fieldTypeRegistry->registerByType('boolean', Checkbox::class, 'bool');
278 278
 
279
-            $fieldTypeRegistry->registerByRelation( 'file', ArboryFile::class );
280
-            $fieldTypeRegistry->registerByRelation( 'image', ArboryImage::class );
281
-            $fieldTypeRegistry->registerByRelation( 'link', Link::class );
279
+            $fieldTypeRegistry->registerByRelation('file', ArboryFile::class);
280
+            $fieldTypeRegistry->registerByRelation('image', ArboryImage::class);
281
+            $fieldTypeRegistry->registerByRelation('link', Link::class);
282 282
 
283 283
             return $fieldTypeRegistry;
284 284
         } );
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
      */
290 290
     private function registerGeneratorStubs()
291 291
     {
292
-        $this->app->singleton( StubRegistry::class, function( Application $app )
292
+        $this->app->singleton(StubRegistry::class, function(Application $app)
293 293
         {
294 294
             $stubRegistry = new StubRegistry();
295 295
 
296 296
             $stubRegistry->registerStubs(
297 297
                 $app[ Filesystem::class ],
298
-                base_path( 'vendor/arbory/arbory/stubs' )
298
+                base_path('vendor/arbory/arbory/stubs')
299 299
             );
300 300
 
301 301
             return $stubRegistry;
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
      */
308 308
     private function registerLocales()
309 309
     {
310
-        config()->set( 'translator.locales', config( 'arbory.locales' ) );
311
-        config()->set( 'translatable.locales', config( 'arbory.locales' ) );
310
+        config()->set('translator.locales', config('arbory.locales'));
311
+        config()->set('translatable.locales', config('arbory.locales'));
312 312
     }
313 313
 
314 314
     /**
@@ -324,44 +324,44 @@  discard block
 block discarded – undo
324 324
      */
325 325
     private function registerValidationRules()
326 326
     {
327
-        $isDestroyed = function( Request $request, $attribute )
327
+        $isDestroyed = function(Request $request, $attribute)
328 328
         {
329
-            $fieldSet = $request->request->get( 'fields' );
330
-            $fields = $fieldSet->findFieldsByInputName( $attribute );
331
-            $fields = array_reverse( $fields );
329
+            $fieldSet = $request->request->get('fields');
330
+            $fields = $fieldSet->findFieldsByInputName($attribute);
331
+            $fields = array_reverse($fields);
332 332
 
333
-            foreach( $fields as $fieldName => $field )
333
+            foreach ($fields as $fieldName => $field)
334 334
             {
335
-                if( $field instanceof HasMany )
335
+                if ($field instanceof HasMany)
336 336
                 {
337
-                    $attributeParts = explode( '.', $attribute );
338
-                    $toManyIndex = array_search( $fieldName, $attributeParts, true );
339
-                    $attributeParent = array_slice( $attributeParts, 0, $toManyIndex + 2 );
340
-                    $attributeParent = implode( '.', $attributeParent );
337
+                    $attributeParts = explode('.', $attribute);
338
+                    $toManyIndex = array_search($fieldName, $attributeParts, true);
339
+                    $attributeParent = array_slice($attributeParts, 0, $toManyIndex + 2);
340
+                    $attributeParent = implode('.', $attributeParent);
341 341
 
342
-                    $isDestroyed = array_get( $request->input( $attributeParent ), '_destroy' );
342
+                    $isDestroyed = array_get($request->input($attributeParent), '_destroy');
343 343
 
344
-                    return filter_var( $isDestroyed, FILTER_VALIDATE_BOOLEAN );
344
+                    return filter_var($isDestroyed, FILTER_VALIDATE_BOOLEAN);
345 345
                 }
346 346
             }
347 347
 
348 348
             return false;
349 349
         };
350 350
 
351
-        \Validator::extendImplicit( 'arbory_file_required', function( $attribute ) use ( $isDestroyed )
351
+        \Validator::extendImplicit('arbory_file_required', function($attribute) use ($isDestroyed)
352 352
         {
353 353
             /** @var FieldSet $fields */
354 354
             $request = \request();
355
-            $fields = $request->request->get( 'fields' );
356
-            $field = $fields->findFieldByInputName( $attribute );
357
-            $file = $request->file( $attribute );
355
+            $fields = $request->request->get('fields');
356
+            $field = $fields->findFieldByInputName($attribute);
357
+            $file = $request->file($attribute);
358 358
 
359
-            if( $isDestroyed( $request, $attribute ) )
359
+            if ($isDestroyed($request, $attribute))
360 360
             {
361 361
                 return true;
362 362
             }
363 363
 
364
-            if( !$field )
364
+            if (!$field)
365 365
             {
366 366
                 return (bool) $file;
367 367
             }
@@ -369,28 +369,28 @@  discard block
 block discarded – undo
369 369
             return $field->getValue() || $file;
370 370
         } );
371 371
 
372
-        \Validator::extendImplicit( 'arbory_require_one_localized', function( $attribute, $value ) use ( $isDestroyed )
372
+        \Validator::extendImplicit('arbory_require_one_localized', function($attribute, $value) use ($isDestroyed)
373 373
         {
374 374
             /** @var FieldSet $fieldSet */
375 375
             $request = \request();
376
-            $fieldSet = $request->request->get( 'fields' );
377
-            $fields = $fieldSet->findFieldsByInputName( $attribute );
376
+            $fieldSet = $request->request->get('fields');
377
+            $fields = $fieldSet->findFieldsByInputName($attribute);
378 378
             $translatable = null;
379 379
 
380
-            if( $isDestroyed( $request, $attribute ) )
380
+            if ($isDestroyed($request, $attribute))
381 381
             {
382 382
                 return true;
383 383
             }
384 384
 
385
-            foreach( array_reverse( $fields ) as $index => $field )
385
+            foreach (array_reverse($fields) as $index => $field)
386 386
             {
387
-                if ( $field instanceof Translatable )
387
+                if ($field instanceof Translatable)
388 388
                 {
389 389
                     $translatable = $field;
390 390
                 }
391 391
             }
392 392
 
393
-            if ( !$translatable || $value )
393
+            if (!$translatable || $value)
394 394
             {
395 395
                 return (bool) $value;
396 396
             }
@@ -398,22 +398,22 @@  discard block
 block discarded – undo
398 398
             $attributeLocale = null;
399 399
             $checkLocales = $translatable->getLocales();
400 400
 
401
-            foreach( $checkLocales as $index => $checkLocale )
401
+            foreach ($checkLocales as $index => $checkLocale)
402 402
             {
403
-                if( str_contains( $attribute, $checkLocale ) )
403
+                if (str_contains($attribute, $checkLocale))
404 404
                 {
405 405
                     $attributeLocale = $checkLocale;
406
-                    unset( $checkLocales[ $index ] );
406
+                    unset($checkLocales[ $index ]);
407 407
                     break;
408 408
                 }
409 409
             }
410 410
 
411
-            foreach( $checkLocales as $index => $checkLocale )
411
+            foreach ($checkLocales as $index => $checkLocale)
412 412
             {
413
-                $checkByAttribute = str_replace( $attributeLocale, $checkLocale, $attribute );
414
-                $field = $fieldSet->findFieldByInputName( $checkByAttribute );
413
+                $checkByAttribute = str_replace($attributeLocale, $checkLocale, $attribute);
414
+                $field = $fieldSet->findFieldByInputName($checkByAttribute);
415 415
 
416
-                if( $request->input( $checkByAttribute ) || ( $field->getValue() && $request->input( $checkByAttribute ) !== null ) )
416
+                if ($request->input($checkByAttribute) || ($field->getValue() && $request->input($checkByAttribute) !== null))
417 417
                 {
418 418
                     return true;
419 419
                 }
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
      */
429 429
     private function registerAssets()
430 430
     {
431
-        \App::booted( function()
431
+        \App::booted(function()
432 432
         {
433
-            \Admin::assets()->js( '/js/admin.js' );
433
+            \Admin::assets()->js('/js/admin.js');
434 434
         } );
435 435
     }
436 436
 
Please login to merge, or discard this patch.
src/Http/Middleware/ArboryAdminModuleAccessMiddleware.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * ArboryAdminModuleAccessMiddleware constructor.
24 24
      * @param Sentinel $sentinel
25 25
      */
26
-    public function __construct( Sentinel $sentinel )
26
+    public function __construct(Sentinel $sentinel)
27 27
     {
28 28
         $this->sentinel = $sentinel;
29 29
     }
@@ -35,49 +35,49 @@  discard block
 block discarded – undo
35 35
      * @param \Closure $next
36 36
      * @return mixed
37 37
      */
38
-    public function handle( $request, Closure $next )
38
+    public function handle($request, Closure $next)
39 39
     {
40
-        $targetModule = $this->resolveTargetModule( $request );
40
+        $targetModule = $this->resolveTargetModule($request);
41 41
 
42
-        if( !$targetModule )
42
+        if (!$targetModule)
43 43
         {
44
-            throw new \RuntimeException( 'Could not find target module for route controller' );
44
+            throw new \RuntimeException('Could not find target module for route controller');
45 45
         }
46 46
 
47
-        if( !$targetModule->isAuthorized() )
47
+        if (!$targetModule->isAuthorized())
48 48
         {
49
-            return $this->denied( $request );
49
+            return $this->denied($request);
50 50
         }
51 51
 
52
-        return $next( $request );
52
+        return $next($request);
53 53
     }
54 54
 
55 55
     /**
56 56
      * @param Request $request
57 57
      * @return JsonResponse|RedirectResponse
58 58
      */
59
-    private function denied( Request $request )
59
+    private function denied(Request $request)
60 60
     {
61 61
         $message = 'Unauthorized';
62 62
 
63
-        if( $request->ajax() )
63
+        if ($request->ajax())
64 64
         {
65
-            return response()->json( [ 'error' => $message ], 401 );
65
+            return response()->json([ 'error' => $message ], 401);
66 66
         }
67 67
 
68 68
         return redirect()
69
-            ->guest( route( 'admin.login.form' ) )
70
-            ->with( 'error', $message );
69
+            ->guest(route('admin.login.form'))
70
+            ->with('error', $message);
71 71
     }
72 72
 
73 73
     /**
74 74
      * @param Request $request
75 75
      * @return \Arbory\Base\Admin\Module|null
76 76
      */
77
-    private function resolveTargetModule( Request $request )
77
+    private function resolveTargetModule(Request $request)
78 78
     {
79 79
         $controller = $request->route()->getController();
80 80
 
81
-        return \Admin::modules()->findModuleByController( $controller );
81
+        return \Admin::modules()->findModuleByController($controller);
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
src/Http/Middleware/ArboryAdminAuthMiddleware.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * ArboryAdminAuthMiddleware constructor.
24 24
      * @param Sentinel $sentinel
25 25
      */
26
-    public function __construct( Sentinel $sentinel )
26
+    public function __construct(Sentinel $sentinel)
27 27
     {
28 28
         $this->sentinel = $sentinel;
29 29
     }
@@ -35,31 +35,31 @@  discard block
 block discarded – undo
35 35
      * @param \Closure $next
36 36
      * @return mixed
37 37
      */
38
-    public function handle( $request, Closure $next )
38
+    public function handle($request, Closure $next)
39 39
     {
40
-        if( !$this->sentinel->check() )
40
+        if (!$this->sentinel->check())
41 41
         {
42
-            return $this->denied( $request );
42
+            return $this->denied($request);
43 43
         }
44 44
 
45
-        return $next( $request );
45
+        return $next($request);
46 46
     }
47 47
 
48 48
     /**
49 49
      * @param Request $request
50 50
      * @return JsonResponse|RedirectResponse
51 51
      */
52
-    private function denied( Request $request )
52
+    private function denied(Request $request)
53 53
     {
54 54
         $message = 'Unauthorized';
55 55
 
56
-        if( $request->ajax() )
56
+        if ($request->ajax())
57 57
         {
58
-            return response()->json( [ 'error' => $message ], 401 );
58
+            return response()->json([ 'error' => $message ], 401);
59 59
         }
60 60
 
61 61
         return redirect()
62
-            ->guest( route( 'admin.login.form' ) )
63
-            ->with( 'error', $message );
62
+            ->guest(route('admin.login.form'))
63
+            ->with('error', $message);
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
routes/admin.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-Route::get( '/', [ 'as' => 'login.form', 'uses' => 'Admin\SecurityController@getLogin' ] );
4
-Route::post( 'login', [ 'as' => 'login.attempt', 'uses' => 'Admin\SecurityController@postLogin' ] );
5
-Route::post( 'logout', [ 'as' => 'logout', 'uses' => 'Admin\SecurityController@postLogout' ] );
3
+Route::get('/', [ 'as' => 'login.form', 'uses' => 'Admin\SecurityController@getLogin' ]);
4
+Route::post('login', [ 'as' => 'login.attempt', 'uses' => 'Admin\SecurityController@postLogin' ]);
5
+Route::post('logout', [ 'as' => 'logout', 'uses' => 'Admin\SecurityController@postLogout' ]);
6 6
 
7
-Route::group( [ 'middleware' => 'arbory.admin_auth' ], function () {
8
-    Route::group( [ 'middleware' => 'arbory.admin_module_access' ], function ()
7
+Route::group([ 'middleware' => 'arbory.admin_auth' ], function() {
8
+    Route::group([ 'middleware' => 'arbory.admin_module_access' ], function()
9 9
     {
10
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\DashboardController::class );
11
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\UsersController::class );
12
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\RolesController::class );
13
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\NodesController::class );
14
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\TranslationsController::class );
15
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\SettingsController::class );
16
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\RedirectsController::class );
17
-        Admin::modules()->register( \Arbory\Base\Http\Controllers\Admin\LanguageController::class );
18
-
19
-        Route::get( 'translations/edit/{namespace}/{group}/{item}', [
10
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\DashboardController::class);
11
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\UsersController::class);
12
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\RolesController::class);
13
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\NodesController::class);
14
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\TranslationsController::class);
15
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\SettingsController::class);
16
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\RedirectsController::class);
17
+        Admin::modules()->register(\Arbory\Base\Http\Controllers\Admin\LanguageController::class);
18
+
19
+        Route::get('translations/edit/{namespace}/{group}/{item}', [
20 20
             'as' => 'translations.edit',
21 21
             'uses' => 'Admin\TranslationsController@edit'
22
-        ] );
22
+        ]);
23 23
 
24
-        Route::post( 'translations/update', [
24
+        Route::post('translations/update', [
25 25
             'as' => 'translations.update',
26 26
             'uses' => 'Admin\TranslationsController@store'
27
-        ] );
27
+        ]);
28 28
 
29
-        Route::post( 'language/{language}/disable', [
29
+        Route::post('language/{language}/disable', [
30 30
             'as' => 'language.disable',
31 31
             'uses' => 'Admin\LanguageController@disable'
32
-        ] );
32
+        ]);
33 33
 
34
-        Route::post( 'language/{language}/restore', [
34
+        Route::post('language/{language}/restore', [
35 35
             'as' => 'language.restore',
36 36
             'uses' => 'Admin\LanguageController@restore'
37
-        ] );
37
+        ]);
38 38
     } );
39 39
 
40
-    Route::post( 'file-manager/upload', [
40
+    Route::post('file-manager/upload', [
41 41
         'as' => 'filemanager.upload',
42 42
         'uses' => 'Admin\UploadController@upload'
43
-    ] );
43
+    ]);
44 44
 } );
45 45
 
46 46
 
Please login to merge, or discard this patch.