@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function register() |
34 | 34 | { |
35 | - $this->mergeConfigFrom(__DIR__.'/../config/url-aliases.php', 'url-aliases'); |
|
35 | + $this->mergeConfigFrom(__DIR__ . '/../config/url-aliases.php', 'url-aliases'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function publishedConfig() |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function makeMigrations() |
52 | 52 | { |
53 | - if (! class_exists('CreateUrlAliasesTable')) { |
|
53 | + if (!class_exists('CreateUrlAliasesTable')) { |
|
54 | 54 | $timestamp = date('Y_m_d_His', time()); |
55 | 55 | |
56 | - $migrationPath = __DIR__.'/../database/migrations/create_url_aliases_table.php'; |
|
56 | + $migrationPath = __DIR__ . '/../database/migrations/create_url_aliases_table.php'; |
|
57 | 57 | $this->publishes([$migrationPath => database_path('/migrations/' . $timestamp . '_create_url_aliases_table.php'), |
58 | 58 | ], 'url-aliases-migrations'); |
59 | 59 | } |
@@ -26,8 +26,8 @@ |
||
26 | 26 | |
27 | 27 | // redirect in alias |
28 | 28 | if (in_array($redirectStatus, ['301', '302'])) { |
29 | - $params = count($request->all()) ? '?'.http_build_query($request->all()) : ''; |
|
30 | - return redirect(url($urlModel->aliased_path).$params, $redirectStatus); |
|
29 | + $params = count($request->all()) ? '?' . http_build_query($request->all()) : ''; |
|
30 | + return redirect(url($urlModel->aliased_path) . $params, $redirectStatus); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | // is aliased_path |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | $parameters = array_wrap($parameters); |
16 | 16 | |
17 | - if (! empty($parameters[0]) && ($parameters[0] instanceof \Illuminate\Database\Eloquent\Model)) { |
|
17 | + if (!empty($parameters[0]) && ($parameters[0] instanceof \Illuminate\Database\Eloquent\Model)) { |
|
18 | 18 | $entity = $parameters[0]; |
19 | 19 | if ($alias = optional($entity->urlAlias)->aliased_path) { |
20 | 20 | unset($parameters[0]); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | 'available_mathods' => ['GET'], // if empty - available all methods |
10 | 10 | |
11 | - 'ignore_paths' => [ // do not apply aliases for paths |
|
11 | + 'ignore_paths' => [// do not apply aliases for paths |
|
12 | 12 | 'admin/', |
13 | 13 | '*download*', |
14 | 14 | ] |
@@ -13,11 +13,11 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('url_aliases', function (Blueprint $table) { |
|
16 | + Schema::create('url_aliases', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | - $table->string('system_path')->nullable(); // system/article/1 |
|
19 | - $table->string('aliased_path')->unique(); // article/some-slug-article |
|
20 | - $table->string('type', 25)->nullable(); // null (is alias) | 301 | 302 |
|
18 | + $table->string('system_path')->nullable(); // system/article/1 |
|
19 | + $table->string('aliased_path')->unique(); // article/some-slug-article |
|
20 | + $table->string('type', 25)->nullable(); // null (is alias) | 301 | 302 |
|
21 | 21 | $table->string('model_type')->nullable(); |
22 | 22 | $table->integer('model_id')->nullable(); |
23 | 23 |