@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('dynamic_routes', function (Blueprint $table) { |
|
16 | + Schema::create('dynamic_routes', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('method', 8); |
19 | 19 | $table->text('name'); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function boot() |
17 | 17 | { |
18 | 18 | // Migrations |
19 | - $this->loadMigrationsFrom(__DIR__ . '/Migration'); |
|
19 | + $this->loadMigrationsFrom(__DIR__.'/Migration'); |
|
20 | 20 | |
21 | 21 | // Configuration publishing |
22 | 22 | $this->publishes([ |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public static function isValid(DynamicRoute $route) |
32 | 32 | { |
33 | - if(isset($route->configuration['target']) === false) { |
|
33 | + if (isset($route->configuration['target']) === false) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function process(Request $request, DynamicRoute $route) |
22 | 22 | { |
23 | - if(isset($route->configuration['status_code']) && in_array((int)$route->configuration['status_code'], [300,301,302,303,304,305,307,308])) { |
|
23 | + if (isset($route->configuration['status_code']) && in_array((int)$route->configuration['status_code'], [300, 301, 302, 303, 304, 305, 307, 308])) { |
|
24 | 24 | return Redirect::to($route->configuration['target'], (int)$route->configuration['status_code']); |
25 | 25 | } |
26 | 26 | return Redirect::to($route->configuration['target']); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function isValid(DynamicRoute $route) |
35 | 35 | { |
36 | - if(isset($route->configuration['target']) === false) { |
|
36 | + if (isset($route->configuration['target']) === false) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $deleted = $this->publisher->cleanupProvidedRoutes(); |
54 | 54 | |
55 | 55 | $this->output->writeln('<info>Deleted '.count($deleted).' dynamic routes:</info>'); |
56 | - foreach($deleted as $route) { |
|
56 | + foreach ($deleted as $route) { |
|
57 | 57 | $this->output->writeln('<info>- '.$route->name.'</info>'); |
58 | 58 | } |
59 | 59 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $published = $this->publisher->publishProvidedRoutes(); |
54 | 54 | |
55 | 55 | $this->output->writeln('<info>Published '.count($published).' new dynamic routes:</info>'); |
56 | - foreach($published as $route) { |
|
56 | + foreach ($published as $route) { |
|
57 | 57 | $this->output->writeln('<info>- '.$route->name.'</info>'); |
58 | 58 | } |
59 | 59 |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function getInstance($handlerIdentifier) |
21 | 21 | { |
22 | - foreach(config('dynamic-routing.handlers') as $handlerClass) { |
|
22 | + foreach (config('dynamic-routing.handlers') as $handlerClass) { |
|
23 | 23 | $handlerMetadata = new ReflectionClass($handlerClass); |
24 | - if($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
24 | + if ($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
25 | 25 | /** @var AbstractRouteTypeHandler $handler */ |
26 | 26 | return new $handlerClass(); |
27 | 27 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function handlerExists($handlerIdentifier) |
38 | 38 | { |
39 | - foreach(config('dynamic-routing.handlers') as $handlerClass) { |
|
39 | + foreach (config('dynamic-routing.handlers') as $handlerClass) { |
|
40 | 40 | $handlerMetadata = new ReflectionClass($handlerClass); |
41 | - if($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
41 | + if ($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
42 | 42 | return true; |
43 | 43 | } |
44 | 44 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function compileRoute(DynamicRoute $dynamicRoute) |
23 | 23 | { |
24 | 24 | $action = 'ElementsFramework\DynamicRouting\Service\RouteClosureProvider::forRouteId('.$dynamicRoute->id.')'; |
25 | - return 'Route::' . $dynamicRoute->method . '("'.$dynamicRoute->pattern.'", '.$action.')->name("'.$dynamicRoute->name.'");'; |
|
25 | + return 'Route::'.$dynamicRoute->method.'("'.$dynamicRoute->pattern.'", '.$action.')->name("'.$dynamicRoute->name.'");'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | $routes = DynamicRoute::all(); |
35 | 35 | |
36 | 36 | $output = ""; |
37 | - if(!empty(config('dynamic-routing.middleware-group'))) { |
|
38 | - $output .= "Route::group(['middleware' => '".config('dynamic-routing.middleware-group')."'], function () {" . PHP_EOL; |
|
37 | + if (!empty(config('dynamic-routing.middleware-group'))) { |
|
38 | + $output .= "Route::group(['middleware' => '".config('dynamic-routing.middleware-group')."'], function () {".PHP_EOL; |
|
39 | 39 | } |
40 | - foreach($routes as $route) { |
|
41 | - $output .= $this->compileRoute($route) . PHP_EOL; |
|
40 | + foreach ($routes as $route) { |
|
41 | + $output .= $this->compileRoute($route).PHP_EOL; |
|
42 | 42 | } |
43 | - if(!empty(config('dynamic-routing.middleware-group'))) { |
|
44 | - $output .= "});" . PHP_EOL; |
|
43 | + if (!empty(config('dynamic-routing.middleware-group'))) { |
|
44 | + $output .= "});".PHP_EOL; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $output; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function compileToFile() |
54 | 54 | { |
55 | 55 | $contents = $this->compileAllRoutes(); |
56 | - $contents = "<?php" . PHP_EOL . $contents; |
|
56 | + $contents = "<?php".PHP_EOL.$contents; |
|
57 | 57 | File::put(base_path(config('dynamic-routing.compiled-routes-path')), $contents); |
58 | 58 | } |
59 | 59 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | Route::group([ |
18 | 18 | 'middleware' => config('dynamic-routing.middleware-group'), |
19 | - ], function ($router) { |
|
19 | + ], function($router) { |
|
20 | 20 | require base_path(config('dynamic-routing.compiled-routes-path')); |
21 | 21 | }); |
22 | 22 | } |