@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('authors', function (Blueprint $table) { |
|
| 20 | + Schema::create('authors', function(Blueprint $table) { |
|
| 21 | 21 | $table->increments('id'); |
| 22 | 22 | $table->string('name'); |
| 23 | 23 | }); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('posts', function (Blueprint $table) { |
|
| 20 | + Schema::create('posts', function(Blueprint $table) { |
|
| 21 | 21 | $table->increments('id'); |
| 22 | 22 | $table->string('title'); |
| 23 | 23 | $table->string('subtitle')->nullable(); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $this->mergeConfigFrom(__DIR__ . '/../resources/config/sluggable.php', 'sluggable'); |
| 42 | 42 | |
| 43 | - $this->app->singleton(SluggableObserver::class, function ($app) { |
|
| 43 | + $this->app->singleton(SluggableObserver::class, function($app) { |
|
| 44 | 44 | return new SluggableObserver(new SlugService(), $app['events']); |
| 45 | 45 | }); |
| 46 | 46 | } |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | return $this->model->__toString(); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $sourceStrings = array_map(function ($key) { |
|
| 131 | + $sourceStrings = array_map(function($key) { |
|
| 132 | 132 | return array_get($this->model, $key); |
| 133 | - }, (array)$from); |
|
| 133 | + }, (array) $from); |
|
| 134 | 134 | |
| 135 | 135 | return join($sourceStrings, ' '); |
| 136 | 136 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | return end($suffix); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - $list->transform(function ($value, $key) use ($len) { |
|
| 288 | + $list->transform(function($value, $key) use ($len) { |
|
| 289 | 289 | return intval(substr($value, $len)); |
| 290 | 290 | }); |
| 291 | 291 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | $fields = $this->slugFieldsGuard($query, $fields); |
| 10 | 10 | |
| 11 | - return $query->where(function ($q) use ($slug, $fields) { |
|
| 11 | + return $query->where(function($q) use ($slug, $fields) { |
|
| 12 | 12 | foreach ($fields as $column) { |
| 13 | 13 | $q->orWhere($column, $slug); |
| 14 | 14 | } |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $found = is_numeric($slugOrId) ? static::find($slugOrId) : null; |
| 31 | 31 | |
| 32 | - return ! is_null($found) ? $found: static::whereOneOfMySlugs($slugOrId, $fields)->first(); |
|
| 32 | + return !is_null($found) ? $found : static::whereOneOfMySlugs($slugOrId, $fields)->first(); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public static function findBySlugOrIdOrFail($slugOrId, $fields = []) |
| 36 | 36 | { |
| 37 | 37 | $found = is_numeric($slugOrId) ? static::find($slugOrId) : null; |
| 38 | 38 | |
| 39 | - return ! is_null($found) ? $found : static::whereOneOfMySlugs($slugOrId, $fields)->firstOrFail(); |
|
| 39 | + return !is_null($found) ? $found : static::whereOneOfMySlugs($slugOrId, $fields)->firstOrFail(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | protected function slugFieldsGuard(Builder $query, $fields = []) |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | $fields = (array) $fields; |
| 46 | 46 | |
| 47 | 47 | if (empty($fields)) { |
| 48 | - return empty($this->findBySlugDefault()) ? $availableSlugFields: $this->findBySlugDefault(); |
|
| 48 | + return empty($this->findBySlugDefault()) ? $availableSlugFields : $this->findBySlugDefault(); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if (! empty($diff = array_diff($fields, $availableSlugFields))) { |
|
| 51 | + if (!empty($diff = array_diff($fields, $availableSlugFields))) { |
|
| 52 | 52 | throw new \InvalidArgumentException('Invalid slugs field(s) ' . implode(', ', $diff)); |
| 53 | 53 | } |
| 54 | 54 | |