@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Console\Migrations; |
4 | 4 | |
5 | -use Illuminate\Support\Collection; |
|
6 | 5 | use Illuminate\Database\Migrations\Migrator; |
6 | +use Illuminate\Support\Collection; |
|
7 | 7 | use Symfony\Component\Console\Input\InputOption; |
8 | 8 | |
9 | 9 | class StatusCommand extends BaseCommand |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->migrator->setConnection($this->option('database')); |
53 | 53 | |
54 | - if (! $this->migrator->repositoryExists()) { |
|
54 | + if (!$this->migrator->repositoryExists()) { |
|
55 | 55 | return $this->error('No migrations found.'); |
56 | 56 | } |
57 | 57 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | protected function getStatusFor(array $ran, array $batches) |
77 | 77 | { |
78 | 78 | return Collection::make($this->getAllMigrationFiles()) |
79 | - ->map(function ($migration) use ($ran, $batches) { |
|
79 | + ->map(function($migration) use ($ran, $batches) { |
|
80 | 80 | $migrationName = $this->migrator->getMigrationName($migration); |
81 | 81 | |
82 | 82 | return in_array($migrationName, $ran) |
@@ -76,7 +76,7 @@ |
||
76 | 76 | protected function getStatusFor(array $ran, array $batches) |
77 | 77 | { |
78 | 78 | return Collection::make($this->getAllMigrationFiles()) |
79 | - ->map(function ($migration) use ($ran, $batches) { |
|
79 | + ->map(function ($migration) use ($ran, $batches){ |
|
80 | 80 | $migrationName = $this->migrator->getMigrationName($migration); |
81 | 81 | |
82 | 82 | return in_array($migrationName, $ran) |
@@ -3,10 +3,10 @@ |
||
3 | 3 | namespace Illuminate\Database\Console\Seeds; |
4 | 4 | |
5 | 5 | use Illuminate\Console\Command; |
6 | -use Illuminate\Database\Eloquent\Model; |
|
7 | 6 | use Illuminate\Console\ConfirmableTrait; |
8 | -use Symfony\Component\Console\Input\InputOption; |
|
9 | 7 | use Illuminate\Database\ConnectionResolverInterface as Resolver; |
8 | +use Illuminate\Database\Eloquent\Model; |
|
9 | +use Symfony\Component\Console\Input\InputOption; |
|
10 | 10 | |
11 | 11 | class SeedCommand extends Command |
12 | 12 | { |
@@ -53,13 +53,13 @@ |
||
53 | 53 | */ |
54 | 54 | public function handle() |
55 | 55 | { |
56 | - if (! $this->confirmToProceed()) { |
|
56 | + if (!$this->confirmToProceed()) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | 60 | $this->resolver->setDefaultConnection($this->getDatabase()); |
61 | 61 | |
62 | - Model::unguarded(function () { |
|
62 | + Model::unguarded(function(){ |
|
63 | 63 | $this->getSeeder()->__invoke(); |
64 | 64 | }); |
65 | 65 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $this->resolver->setDefaultConnection($this->getDatabase()); |
61 | 61 | |
62 | - Model::unguarded(function () { |
|
62 | + Model::unguarded(function (){ |
|
63 | 63 | $this->getSeeder()->__invoke(); |
64 | 64 | }); |
65 | 65 | } |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Console\Seeds; |
4 | 4 | |
5 | -use Illuminate\Support\Composer; |
|
6 | -use Illuminate\Filesystem\Filesystem; |
|
7 | 5 | use Illuminate\Console\GeneratorCommand; |
6 | +use Illuminate\Filesystem\Filesystem; |
|
7 | +use Illuminate\Support\Composer; |
|
8 | 8 | |
9 | 9 | class SeederMakeCommand extends GeneratorCommand |
10 | 10 | { |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | /** |
274 | 274 | * Get all of the support drivers. |
275 | 275 | * |
276 | - * @return array |
|
276 | + * @return string[] |
|
277 | 277 | */ |
278 | 278 | public function supportedDrivers() |
279 | 279 | { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | /** |
284 | 284 | * Get all of the drivers that are actually available. |
285 | 285 | * |
286 | - * @return array |
|
286 | + * @return string[] |
|
287 | 287 | */ |
288 | 288 | public function availableDrivers() |
289 | 289 | { |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database; |
4 | 4 | |
5 | -use PDO; |
|
5 | +use Illuminate\Database\Connectors\ConnectionFactory; |
|
6 | 6 | use Illuminate\Support\Arr; |
7 | 7 | use Illuminate\Support\Str; |
8 | 8 | use InvalidArgumentException; |
9 | -use Illuminate\Database\Connectors\ConnectionFactory; |
|
9 | +use PDO; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @mixin \Illuminate\Database\Connection |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // If we haven't created this connection, we'll create it based on the config |
70 | 70 | // provided in the application. Once we've created the connections we will |
71 | 71 | // set the "fetch mode" for PDO which determines the query return types. |
72 | - if (! isset($this->connections[$name])) { |
|
72 | + if (!isset($this->connections[$name])) { |
|
73 | 73 | $this->connections[$name] = $this->configure( |
74 | 74 | $this->makeConnection($database), $type |
75 | 75 | ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // Here we'll set a reconnector callback. This reconnector can be any callable |
165 | 165 | // so we will set a Closure to reconnect from this manager with the name of |
166 | 166 | // the connection, which will allow us to reconnect from the connections. |
167 | - $connection->setReconnector(function ($connection) { |
|
167 | + $connection->setReconnector(function($connection){ |
|
168 | 168 | $this->reconnect($connection->getName()); |
169 | 169 | }); |
170 | 170 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $this->disconnect($name = $name ?: $this->getDefaultConnection()); |
229 | 229 | |
230 | - if (! isset($this->connections[$name])) { |
|
230 | + if (!isset($this->connections[$name])) { |
|
231 | 231 | return $this->connection($name); |
232 | 232 | } |
233 | 233 |
@@ -164,7 +164,7 @@ |
||
164 | 164 | // Here we'll set a reconnector callback. This reconnector can be any callable |
165 | 165 | // so we will set a Closure to reconnect from this manager with the name of |
166 | 166 | // the connection, which will allow us to reconnect from the connections. |
167 | - $connection->setReconnector(function ($connection) { |
|
167 | + $connection->setReconnector(function ($connection){ |
|
168 | 168 | $this->reconnect($connection->getName()); |
169 | 169 | }); |
170 | 170 |
@@ -4,12 +4,12 @@ |
||
4 | 4 | |
5 | 5 | use Faker\Factory as FakerFactory; |
6 | 6 | use Faker\Generator as FakerGenerator; |
7 | -use Illuminate\Database\Eloquent\Model; |
|
8 | -use Illuminate\Support\ServiceProvider; |
|
9 | 7 | use Illuminate\Contracts\Queue\EntityResolver; |
10 | 8 | use Illuminate\Database\Connectors\ConnectionFactory; |
11 | -use Illuminate\Database\Eloquent\QueueEntityResolver; |
|
12 | 9 | use Illuminate\Database\Eloquent\Factory as EloquentFactory; |
10 | +use Illuminate\Database\Eloquent\Model; |
|
11 | +use Illuminate\Database\Eloquent\QueueEntityResolver; |
|
12 | +use Illuminate\Support\ServiceProvider; |
|
13 | 13 | |
14 | 14 | class DatabaseServiceProvider extends ServiceProvider |
15 | 15 | { |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | // The connection factory is used to create the actual connection instances on |
52 | 52 | // the database. We will inject the factory into the manager so that it may |
53 | 53 | // make the connections while they are actually needed and not of before. |
54 | - $this->app->singleton('db.factory', function ($app) { |
|
54 | + $this->app->singleton('db.factory', function($app){ |
|
55 | 55 | return new ConnectionFactory($app); |
56 | 56 | }); |
57 | 57 | |
58 | 58 | // The database manager is used to resolve various connections, since multiple |
59 | 59 | // connections might be managed. It also implements the connection resolver |
60 | 60 | // interface which may be used by other components requiring connections. |
61 | - $this->app->singleton('db', function ($app) { |
|
61 | + $this->app->singleton('db', function($app){ |
|
62 | 62 | return new DatabaseManager($app, $app['db.factory']); |
63 | 63 | }); |
64 | 64 | |
65 | - $this->app->bind('db.connection', function ($app) { |
|
65 | + $this->app->bind('db.connection', function($app){ |
|
66 | 66 | return $app['db']->connection(); |
67 | 67 | }); |
68 | 68 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function registerEloquentFactory() |
76 | 76 | { |
77 | - $this->app->singleton(FakerGenerator::class, function ($app) { |
|
77 | + $this->app->singleton(FakerGenerator::class, function($app){ |
|
78 | 78 | return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US')); |
79 | 79 | }); |
80 | 80 | |
81 | - $this->app->singleton(EloquentFactory::class, function ($app) { |
|
81 | + $this->app->singleton(EloquentFactory::class, function($app){ |
|
82 | 82 | return EloquentFactory::construct( |
83 | 83 | $app->make(FakerGenerator::class), $this->app->databasePath('factories') |
84 | 84 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function registerQueueableEntityResolver() |
94 | 94 | { |
95 | - $this->app->singleton(EntityResolver::class, function () { |
|
95 | + $this->app->singleton(EntityResolver::class, function(){ |
|
96 | 96 | return new QueueEntityResolver; |
97 | 97 | }); |
98 | 98 | } |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | // The connection factory is used to create the actual connection instances on |
52 | 52 | // the database. We will inject the factory into the manager so that it may |
53 | 53 | // make the connections while they are actually needed and not of before. |
54 | - $this->app->singleton('db.factory', function ($app) { |
|
54 | + $this->app->singleton('db.factory', function ($app){ |
|
55 | 55 | return new ConnectionFactory($app); |
56 | 56 | }); |
57 | 57 | |
58 | 58 | // The database manager is used to resolve various connections, since multiple |
59 | 59 | // connections might be managed. It also implements the connection resolver |
60 | 60 | // interface which may be used by other components requiring connections. |
61 | - $this->app->singleton('db', function ($app) { |
|
61 | + $this->app->singleton('db', function ($app){ |
|
62 | 62 | return new DatabaseManager($app, $app['db.factory']); |
63 | 63 | }); |
64 | 64 | |
65 | - $this->app->bind('db.connection', function ($app) { |
|
65 | + $this->app->bind('db.connection', function ($app){ |
|
66 | 66 | return $app['db']->connection(); |
67 | 67 | }); |
68 | 68 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function registerEloquentFactory() |
76 | 76 | { |
77 | - $this->app->singleton(FakerGenerator::class, function ($app) { |
|
77 | + $this->app->singleton(FakerGenerator::class, function ($app){ |
|
78 | 78 | return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US')); |
79 | 79 | }); |
80 | 80 | |
81 | - $this->app->singleton(EloquentFactory::class, function ($app) { |
|
81 | + $this->app->singleton(EloquentFactory::class, function ($app){ |
|
82 | 82 | return EloquentFactory::construct( |
83 | 83 | $app->make(FakerGenerator::class), $this->app->databasePath('factories') |
84 | 84 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function registerQueueableEntityResolver() |
94 | 94 | { |
95 | - $this->app->singleton(EntityResolver::class, function () { |
|
95 | + $this->app->singleton(EntityResolver::class, function (){ |
|
96 | 96 | return new QueueEntityResolver; |
97 | 97 | }); |
98 | 98 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database; |
4 | 4 | |
5 | -use Throwable; |
|
6 | 5 | use Illuminate\Support\Str; |
6 | +use Throwable; |
|
7 | 7 | |
8 | 8 | trait DetectsLostConnections |
9 | 9 | { |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * Add an "or where" clause to the query. |
234 | 234 | * |
235 | 235 | * @param \Closure|array|string $column |
236 | - * @param mixed $operator |
|
237 | - * @param mixed $value |
|
236 | + * @param string $operator |
|
237 | + * @param integer $value |
|
238 | 238 | * @return \Illuminate\Database\Eloquent\Builder|static |
239 | 239 | */ |
240 | 240 | public function orWhere($column, $operator = null, $value = null) |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * Execute the query as a "select" statement. |
454 | 454 | * |
455 | 455 | * @param array $columns |
456 | - * @return \Illuminate\Database\Eloquent\Collection|static[] |
|
456 | + * @return \Illuminate\Support\Collection |
|
457 | 457 | */ |
458 | 458 | public function get($columns = ['*']) |
459 | 459 | { |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | * Increment a column's value by a given amount. |
785 | 785 | * |
786 | 786 | * @param string $column |
787 | - * @param float|int $amount |
|
787 | + * @param integer $amount |
|
788 | 788 | * @param array $extra |
789 | 789 | * @return int |
790 | 790 | */ |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * Decrement a column's value by a given amount. |
800 | 800 | * |
801 | 801 | * @param string $column |
802 | - * @param float|int $amount |
|
802 | + * @param integer $amount |
|
803 | 803 | * @param array $extra |
804 | 804 | * @return int |
805 | 805 | */ |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * |
848 | 848 | * Since we do not apply scopes here, the row will actually be deleted. |
849 | 849 | * |
850 | - * @return mixed |
|
850 | + * @return integer |
|
851 | 851 | */ |
852 | 852 | public function forceDelete() |
853 | 853 | { |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Eloquent; |
4 | 4 | |
5 | -use Closure; |
|
6 | 5 | use BadMethodCallException; |
7 | -use Illuminate\Support\Arr; |
|
8 | -use Illuminate\Support\Str; |
|
9 | -use Illuminate\Pagination\Paginator; |
|
6 | +use Closure; |
|
10 | 7 | use Illuminate\Contracts\Support\Arrayable; |
11 | 8 | use Illuminate\Database\Concerns\BuildsQueries; |
12 | 9 | use Illuminate\Database\Eloquent\Relations\Relation; |
13 | 10 | use Illuminate\Database\Query\Builder as QueryBuilder; |
11 | +use Illuminate\Pagination\Paginator; |
|
12 | +use Illuminate\Support\Arr; |
|
13 | +use Illuminate\Support\Str; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @mixin \Illuminate\Database\Query\Builder |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function withoutGlobalScope($scope) |
135 | 135 | { |
136 | - if (! is_string($scope)) { |
|
136 | + if (!is_string($scope)) { |
|
137 | 137 | $scope = get_class($scope); |
138 | 138 | } |
139 | 139 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function withoutGlobalScopes(array $scopes = null) |
154 | 154 | { |
155 | - if (! is_array($scopes)) { |
|
155 | + if (!is_array($scopes)) { |
|
156 | 156 | $scopes = array_keys($this->scopes); |
157 | 157 | } |
158 | 158 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | { |
257 | 257 | $instance = $this->newModelInstance(); |
258 | 258 | |
259 | - return $instance->newCollection(array_map(function ($item) use ($instance) { |
|
259 | + return $instance->newCollection(array_map(function($item) use ($instance) { |
|
260 | 260 | return $instance->newFromBuilder($item); |
261 | 261 | }, $items)); |
262 | 262 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | if (count($result) === count(array_unique($id))) { |
325 | 325 | return $result; |
326 | 326 | } |
327 | - } elseif (! is_null($result)) { |
|
327 | + } elseif (!is_null($result)) { |
|
328 | 328 | return $result; |
329 | 329 | } |
330 | 330 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function findOrNew($id, $columns = ['*']) |
344 | 344 | { |
345 | - if (! is_null($model = $this->find($id, $columns))) { |
|
345 | + if (!is_null($model = $this->find($id, $columns))) { |
|
346 | 346 | return $model; |
347 | 347 | } |
348 | 348 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function firstOrNew(array $attributes, array $values = []) |
360 | 360 | { |
361 | - if (! is_null($instance = $this->where($attributes)->first())) { |
|
361 | + if (!is_null($instance = $this->where($attributes)->first())) { |
|
362 | 362 | return $instance; |
363 | 363 | } |
364 | 364 | |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function firstOrCreate(array $attributes, array $values = []) |
376 | 376 | { |
377 | - if (! is_null($instance = $this->where($attributes)->first())) { |
|
377 | + if (!is_null($instance = $this->where($attributes)->first())) { |
|
378 | 378 | return $instance; |
379 | 379 | } |
380 | 380 | |
381 | - return tap($this->newModelInstance($attributes + $values), function ($instance) { |
|
381 | + return tap($this->newModelInstance($attributes + $values), function($instance){ |
|
382 | 382 | $instance->save(); |
383 | 383 | }); |
384 | 384 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function updateOrCreate(array $attributes, array $values = []) |
394 | 394 | { |
395 | - return tap($this->firstOrNew($attributes), function ($instance) use ($values) { |
|
395 | + return tap($this->firstOrNew($attributes), function($instance) use ($values) { |
|
396 | 396 | $instance->fill($values)->save(); |
397 | 397 | }); |
398 | 398 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | */ |
408 | 408 | public function firstOrFail($columns = ['*']) |
409 | 409 | { |
410 | - if (! is_null($model = $this->first($columns))) { |
|
410 | + if (!is_null($model = $this->first($columns))) { |
|
411 | 411 | return $model; |
412 | 412 | } |
413 | 413 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $columns = ['*']; |
430 | 430 | } |
431 | 431 | |
432 | - if (! is_null($model = $this->first($columns))) { |
|
432 | + if (!is_null($model = $this->first($columns))) { |
|
433 | 433 | return $model; |
434 | 434 | } |
435 | 435 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | // We want to run a relationship query without any constrains so that we will |
542 | 542 | // not have to remove these where clauses manually which gets really hacky |
543 | 543 | // and error prone. We don't want constraints because we add eager ones. |
544 | - $relation = Relation::noConstraints(function () use ($name) { |
|
544 | + $relation = Relation::noConstraints(function() use ($name) { |
|
545 | 545 | try { |
546 | 546 | return $this->getModel()->newInstance()->$name(); |
547 | 547 | } catch (BadMethodCallException $e) { |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | // If the model has a mutator for the requested column, we will spin through |
680 | 680 | // the results and mutate the values so that the mutated version of these |
681 | 681 | // columns are returned as you would expect from these Eloquent models. |
682 | - if (! $this->model->hasGetMutator($column) && |
|
683 | - ! $this->model->hasCast($column) && |
|
684 | - ! in_array($column, $this->model->getDates())) { |
|
682 | + if (!$this->model->hasGetMutator($column) && |
|
683 | + !$this->model->hasCast($column) && |
|
684 | + !in_array($column, $this->model->getDates())) { |
|
685 | 685 | return $results; |
686 | 686 | } |
687 | 687 | |
688 | - return $results->map(function ($value) use ($column) { |
|
688 | + return $results->map(function($value) use ($column) { |
|
689 | 689 | return $this->model->newFromBuilder([$column => $value])->{$column}; |
690 | 690 | }); |
691 | 691 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | */ |
752 | 752 | public function create(array $attributes = []) |
753 | 753 | { |
754 | - return tap($this->newModelInstance($attributes), function ($instance) { |
|
754 | + return tap($this->newModelInstance($attributes), function($instance){ |
|
755 | 755 | $instance->save(); |
756 | 756 | }); |
757 | 757 | } |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function forceCreate(array $attributes) |
766 | 766 | { |
767 | - return $this->model->unguarded(function () use ($attributes) { |
|
767 | + return $this->model->unguarded(function() use ($attributes) { |
|
768 | 768 | return $this->newModelInstance()->create($attributes); |
769 | 769 | }); |
770 | 770 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | */ |
819 | 819 | protected function addUpdatedAtColumn(array $values) |
820 | 820 | { |
821 | - if (! $this->model->usesTimestamps()) { |
|
821 | + if (!$this->model->usesTimestamps()) { |
|
822 | 822 | return $values; |
823 | 823 | } |
824 | 824 | |
@@ -902,18 +902,18 @@ discard block |
||
902 | 902 | */ |
903 | 903 | public function applyScopes() |
904 | 904 | { |
905 | - if (! $this->scopes) { |
|
905 | + if (!$this->scopes) { |
|
906 | 906 | return $this; |
907 | 907 | } |
908 | 908 | |
909 | 909 | $builder = clone $this; |
910 | 910 | |
911 | 911 | foreach ($this->scopes as $identifier => $scope) { |
912 | - if (! isset($builder->scopes[$identifier])) { |
|
912 | + if (!isset($builder->scopes[$identifier])) { |
|
913 | 913 | continue; |
914 | 914 | } |
915 | 915 | |
916 | - $builder->callScope(function (Builder $builder) use ($scope) { |
|
916 | + $builder->callScope(function(Builder $builder) use ($scope) { |
|
917 | 917 | // If the scope is a Closure we will just go ahead and call the scope with the |
918 | 918 | // builder instance. The "callScope" method will properly group the clauses |
919 | 919 | // that are added to this query so "where" clauses maintain proper logic. |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | |
1088 | 1088 | list($name, $constraints) = Str::contains($name, ':') |
1089 | 1089 | ? $this->createSelectWithConstraint($name) |
1090 | - : [$name, function () { |
|
1090 | + : [$name, function(){ |
|
1091 | 1091 | // |
1092 | 1092 | }]; |
1093 | 1093 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | */ |
1112 | 1112 | protected function createSelectWithConstraint($name) |
1113 | 1113 | { |
1114 | - return [explode(':', $name)[0], function ($query) use ($name) { |
|
1114 | + return [explode(':', $name)[0], function($query) use ($name) { |
|
1115 | 1115 | $query->select(explode(',', explode(':', $name)[1])); |
1116 | 1116 | }]; |
1117 | 1117 | } |
@@ -1133,8 +1133,8 @@ discard block |
||
1133 | 1133 | foreach (explode('.', $name) as $segment) { |
1134 | 1134 | $progress[] = $segment; |
1135 | 1135 | |
1136 | - if (! isset($results[$last = implode('.', $progress)])) { |
|
1137 | - $results[$last] = function () { |
|
1136 | + if (!isset($results[$last = implode('.', $progress)])) { |
|
1137 | + $results[$last] = function(){ |
|
1138 | 1138 | // |
1139 | 1139 | }; |
1140 | 1140 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | return; |
1306 | 1306 | } |
1307 | 1307 | |
1308 | - if (! isset(static::$macros[$method])) { |
|
1308 | + if (!isset(static::$macros[$method])) { |
|
1309 | 1309 | throw new BadMethodCallException(sprintf( |
1310 | 1310 | 'Method %s::%s does not exist.', static::class, $method |
1311 | 1311 | )); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | { |
257 | 257 | $instance = $this->newModelInstance(); |
258 | 258 | |
259 | - return $instance->newCollection(array_map(function ($item) use ($instance) { |
|
259 | + return $instance->newCollection(array_map(function ($item) use ($instance){ |
|
260 | 260 | return $instance->newFromBuilder($item); |
261 | 261 | }, $items)); |
262 | 262 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | return $instance; |
379 | 379 | } |
380 | 380 | |
381 | - return tap($this->newModelInstance($attributes + $values), function ($instance) { |
|
381 | + return tap($this->newModelInstance($attributes + $values), function ($instance){ |
|
382 | 382 | $instance->save(); |
383 | 383 | }); |
384 | 384 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function updateOrCreate(array $attributes, array $values = []) |
394 | 394 | { |
395 | - return tap($this->firstOrNew($attributes), function ($instance) use ($values) { |
|
395 | + return tap($this->firstOrNew($attributes), function ($instance) use ($values){ |
|
396 | 396 | $instance->fill($values)->save(); |
397 | 397 | }); |
398 | 398 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | // We want to run a relationship query without any constrains so that we will |
542 | 542 | // not have to remove these where clauses manually which gets really hacky |
543 | 543 | // and error prone. We don't want constraints because we add eager ones. |
544 | - $relation = Relation::noConstraints(function () use ($name) { |
|
544 | + $relation = Relation::noConstraints(function () use ($name){ |
|
545 | 545 | try { |
546 | 546 | return $this->getModel()->newInstance()->$name(); |
547 | 547 | } catch (BadMethodCallException $e) { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | return $results; |
686 | 686 | } |
687 | 687 | |
688 | - return $results->map(function ($value) use ($column) { |
|
688 | + return $results->map(function ($value) use ($column){ |
|
689 | 689 | return $this->model->newFromBuilder([$column => $value])->{$column}; |
690 | 690 | }); |
691 | 691 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | */ |
752 | 752 | public function create(array $attributes = []) |
753 | 753 | { |
754 | - return tap($this->newModelInstance($attributes), function ($instance) { |
|
754 | + return tap($this->newModelInstance($attributes), function ($instance){ |
|
755 | 755 | $instance->save(); |
756 | 756 | }); |
757 | 757 | } |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function forceCreate(array $attributes) |
766 | 766 | { |
767 | - return $this->model->unguarded(function () use ($attributes) { |
|
767 | + return $this->model->unguarded(function () use ($attributes){ |
|
768 | 768 | return $this->newModelInstance()->create($attributes); |
769 | 769 | }); |
770 | 770 | } |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | continue; |
914 | 914 | } |
915 | 915 | |
916 | - $builder->callScope(function (Builder $builder) use ($scope) { |
|
916 | + $builder->callScope(function (Builder $builder) use ($scope){ |
|
917 | 917 | // If the scope is a Closure we will just go ahead and call the scope with the |
918 | 918 | // builder instance. The "callScope" method will properly group the clauses |
919 | 919 | // that are added to this query so "where" clauses maintain proper logic. |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | |
1088 | 1088 | list($name, $constraints) = Str::contains($name, ':') |
1089 | 1089 | ? $this->createSelectWithConstraint($name) |
1090 | - : [$name, function () { |
|
1090 | + : [$name, function (){ |
|
1091 | 1091 | // |
1092 | 1092 | }]; |
1093 | 1093 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | */ |
1112 | 1112 | protected function createSelectWithConstraint($name) |
1113 | 1113 | { |
1114 | - return [explode(':', $name)[0], function ($query) use ($name) { |
|
1114 | + return [explode(':', $name)[0], function ($query) use ($name){ |
|
1115 | 1115 | $query->select(explode(',', explode(':', $name)[1])); |
1116 | 1116 | }]; |
1117 | 1117 | } |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | $progress[] = $segment; |
1135 | 1135 | |
1136 | 1136 | if (! isset($results[$last = implode('.', $progress)])) { |
1137 | - $results[$last] = function () { |
|
1137 | + $results[$last] = function (){ |
|
1138 | 1138 | // |
1139 | 1139 | }; |
1140 | 1140 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * Determine if a key exists in the collection. |
175 | 175 | * |
176 | - * @param mixed $key |
|
176 | + * @param \Closure $key |
|
177 | 177 | * @param mixed $operator |
178 | 178 | * @param mixed $value |
179 | 179 | * @return bool |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * Merge the collection with the given items. |
212 | 212 | * |
213 | - * @param \ArrayAccess|array $items |
|
213 | + * @param Collection $items |
|
214 | 214 | * @return static |
215 | 215 | */ |
216 | 216 | public function merge($items) |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Eloquent; |
4 | 4 | |
5 | -use LogicException; |
|
6 | -use Illuminate\Support\Arr; |
|
7 | -use Illuminate\Support\Str; |
|
5 | +use Illuminate\Contracts\Queue\QueueableCollection; |
|
8 | 6 | use Illuminate\Contracts\Support\Arrayable; |
9 | 7 | use Illuminate\Database\Eloquent\Relations\Pivot; |
10 | -use Illuminate\Contracts\Queue\QueueableCollection; |
|
8 | +use Illuminate\Support\Arr; |
|
11 | 9 | use Illuminate\Support\Collection as BaseCollection; |
10 | +use Illuminate\Support\Str; |
|
11 | +use LogicException; |
|
12 | 12 | |
13 | 13 | class Collection extends BaseCollection implements QueueableCollection |
14 | 14 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | return $this->whereIn($this->first()->getKeyName(), $key); |
38 | 38 | } |
39 | 39 | |
40 | - return Arr::first($this->items, function ($model) use ($key) { |
|
40 | + return Arr::first($this->items, function($model) use ($key) { |
|
41 | 41 | return $model->getKey() == $key; |
42 | 42 | }, $default); |
43 | 43 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | $relation = reset($relation); |
116 | 116 | } |
117 | 117 | |
118 | - $models->filter(function ($model) use ($name) { |
|
119 | - return ! is_null($model) && ! $model->relationLoaded($name); |
|
118 | + $models->filter(function($model) use ($name) { |
|
119 | + return !is_null($model) && !$model->relationLoaded($name); |
|
120 | 120 | })->load($relation); |
121 | 121 | |
122 | 122 | if (empty($path)) { |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | { |
144 | 144 | $this->pluck($relation) |
145 | 145 | ->filter() |
146 | - ->groupBy(function ($model) { |
|
146 | + ->groupBy(function($model){ |
|
147 | 147 | return get_class($model); |
148 | 148 | }) |
149 | - ->filter(function ($models, $className) use ($relations) { |
|
149 | + ->filter(function($models, $className) use ($relations) { |
|
150 | 150 | return Arr::has($relations, $className); |
151 | 151 | }) |
152 | - ->each(function ($models, $className) use ($relations) { |
|
152 | + ->each(function($models, $className) use ($relations) { |
|
153 | 153 | $className::with($relations[$className]) |
154 | 154 | ->eagerLoadRelations($models->all()); |
155 | 155 | }); |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if ($key instanceof Model) { |
188 | - return parent::contains(function ($model) use ($key) { |
|
188 | + return parent::contains(function($model) use ($key) { |
|
189 | 189 | return $model->is($key); |
190 | 190 | }); |
191 | 191 | } |
192 | 192 | |
193 | - return parent::contains(function ($model) use ($key) { |
|
193 | + return parent::contains(function($model) use ($key) { |
|
194 | 194 | return $model->getKey() == $key; |
195 | 195 | }); |
196 | 196 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function modelKeys() |
204 | 204 | { |
205 | - return array_map(function ($model) { |
|
205 | + return array_map(function($model){ |
|
206 | 206 | return $model->getKey(); |
207 | 207 | }, $this->items); |
208 | 208 | } |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | { |
235 | 235 | $result = parent::map($callback); |
236 | 236 | |
237 | - return $result->contains(function ($item) { |
|
238 | - return ! $item instanceof Model; |
|
237 | + return $result->contains(function($item){ |
|
238 | + return !$item instanceof Model; |
|
239 | 239 | }) ? $result->toBase() : $result; |
240 | 240 | } |
241 | 241 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ->get() |
260 | 260 | ->getDictionary(); |
261 | 261 | |
262 | - return $this->map(function ($model) use ($freshModels) { |
|
262 | + return $this->map(function($model) use ($freshModels) { |
|
263 | 263 | return $model->exists && isset($freshModels[$model->getKey()]) |
264 | 264 | ? $freshModels[$model->getKey()] : null; |
265 | 265 | }); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $dictionary = $this->getDictionary($items); |
279 | 279 | |
280 | 280 | foreach ($this->items as $item) { |
281 | - if (! isset($dictionary[$item->getKey()])) { |
|
281 | + if (!isset($dictionary[$item->getKey()])) { |
|
282 | 282 | $diff->add($item); |
283 | 283 | } |
284 | 284 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function unique($key = null, $strict = false) |
318 | 318 | { |
319 | - if (! is_null($key)) { |
|
319 | + if (!is_null($key)) { |
|
320 | 320 | return parent::unique($key, $strict); |
321 | 321 | } |
322 | 322 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | $class = get_class($this->first()); |
490 | 490 | |
491 | - $this->each(function ($model) use ($class) { |
|
491 | + $this->each(function($model) use ($class) { |
|
492 | 492 | if (get_class($model) !== $class) { |
493 | 493 | throw new LogicException('Queueing collections with multiple model types is not supported.'); |
494 | 494 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | $connection = $this->first()->getConnectionName(); |
539 | 539 | |
540 | - $this->each(function ($model) use ($connection) { |
|
540 | + $this->each(function($model) use ($connection) { |
|
541 | 541 | if ($model->getConnectionName() !== $connection) { |
542 | 542 | throw new LogicException('Queueing collections with multiple model connections is not supported.'); |
543 | 543 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | return $this->whereIn($this->first()->getKeyName(), $key); |
38 | 38 | } |
39 | 39 | |
40 | - return Arr::first($this->items, function ($model) use ($key) { |
|
40 | + return Arr::first($this->items, function ($model) use ($key){ |
|
41 | 41 | return $model->getKey() == $key; |
42 | 42 | }, $default); |
43 | 43 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $relation = reset($relation); |
116 | 116 | } |
117 | 117 | |
118 | - $models->filter(function ($model) use ($name) { |
|
118 | + $models->filter(function ($model) use ($name){ |
|
119 | 119 | return ! is_null($model) && ! $model->relationLoaded($name); |
120 | 120 | })->load($relation); |
121 | 121 | |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | { |
144 | 144 | $this->pluck($relation) |
145 | 145 | ->filter() |
146 | - ->groupBy(function ($model) { |
|
146 | + ->groupBy(function ($model){ |
|
147 | 147 | return get_class($model); |
148 | 148 | }) |
149 | - ->filter(function ($models, $className) use ($relations) { |
|
149 | + ->filter(function ($models, $className) use ($relations){ |
|
150 | 150 | return Arr::has($relations, $className); |
151 | 151 | }) |
152 | - ->each(function ($models, $className) use ($relations) { |
|
152 | + ->each(function ($models, $className) use ($relations){ |
|
153 | 153 | $className::with($relations[$className]) |
154 | 154 | ->eagerLoadRelations($models->all()); |
155 | 155 | }); |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if ($key instanceof Model) { |
188 | - return parent::contains(function ($model) use ($key) { |
|
188 | + return parent::contains(function ($model) use ($key){ |
|
189 | 189 | return $model->is($key); |
190 | 190 | }); |
191 | 191 | } |
192 | 192 | |
193 | - return parent::contains(function ($model) use ($key) { |
|
193 | + return parent::contains(function ($model) use ($key){ |
|
194 | 194 | return $model->getKey() == $key; |
195 | 195 | }); |
196 | 196 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function modelKeys() |
204 | 204 | { |
205 | - return array_map(function ($model) { |
|
205 | + return array_map(function ($model){ |
|
206 | 206 | return $model->getKey(); |
207 | 207 | }, $this->items); |
208 | 208 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $result = parent::map($callback); |
236 | 236 | |
237 | - return $result->contains(function ($item) { |
|
237 | + return $result->contains(function ($item){ |
|
238 | 238 | return ! $item instanceof Model; |
239 | 239 | }) ? $result->toBase() : $result; |
240 | 240 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ->get() |
260 | 260 | ->getDictionary(); |
261 | 261 | |
262 | - return $this->map(function ($model) use ($freshModels) { |
|
262 | + return $this->map(function ($model) use ($freshModels){ |
|
263 | 263 | return $model->exists && isset($freshModels[$model->getKey()]) |
264 | 264 | ? $freshModels[$model->getKey()] : null; |
265 | 265 | }); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | $class = get_class($this->first()); |
490 | 490 | |
491 | - $this->each(function ($model) use ($class) { |
|
491 | + $this->each(function ($model) use ($class){ |
|
492 | 492 | if (get_class($model) !== $class) { |
493 | 493 | throw new LogicException('Queueing collections with multiple model types is not supported.'); |
494 | 494 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | $connection = $this->first()->getConnectionName(); |
539 | 539 | |
540 | - $this->each(function ($model) use ($connection) { |
|
540 | + $this->each(function ($model) use ($connection){ |
|
541 | 541 | if ($model->getConnectionName() !== $connection) { |
542 | 542 | throw new LogicException('Queueing collections with multiple model connections is not supported.'); |
543 | 543 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param array $attributes |
168 | 168 | * @param array $mutatedAttributes |
169 | - * @return array |
|
169 | + * @return string |
|
170 | 170 | */ |
171 | 171 | protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) |
172 | 172 | { |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * Determine if the given value is a standard date format. |
754 | 754 | * |
755 | 755 | * @param string $value |
756 | - * @return bool |
|
756 | + * @return integer |
|
757 | 757 | */ |
758 | 758 | protected function isStandardDateFormat($value) |
759 | 759 | { |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | * Determine whether an attribute should be cast to a native type. |
837 | 837 | * |
838 | 838 | * @param string $key |
839 | - * @param array|string|null $types |
|
839 | + * @param string[] $types |
|
840 | 840 | * @return bool |
841 | 841 | */ |
842 | 842 | public function hasCast($key, $types = null) |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | /** |
1163 | 1163 | * Get all of the attribute mutator methods. |
1164 | 1164 | * |
1165 | - * @param mixed $class |
|
1165 | + * @param string $class |
|
1166 | 1166 | * @return array |
1167 | 1167 | */ |
1168 | 1168 | protected static function getMutatorMethods($class) |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Eloquent\Concerns; |
4 | 4 | |
5 | -use LogicException; |
|
6 | 5 | use DateTimeInterface; |
7 | -use Illuminate\Support\Arr; |
|
8 | -use Illuminate\Support\Str; |
|
9 | -use Illuminate\Support\Carbon; |
|
10 | 6 | use Illuminate\Contracts\Support\Arrayable; |
7 | +use Illuminate\Database\Eloquent\JsonEncodingException; |
|
11 | 8 | use Illuminate\Database\Eloquent\Relations\Relation; |
9 | +use Illuminate\Support\Arr; |
|
10 | +use Illuminate\Support\Carbon; |
|
12 | 11 | use Illuminate\Support\Collection as BaseCollection; |
13 | -use Illuminate\Database\Eloquent\JsonEncodingException; |
|
12 | +use Illuminate\Support\Str; |
|
13 | +use LogicException; |
|
14 | 14 | |
15 | 15 | trait HasAttributes |
16 | 16 | { |
@@ -1092,10 +1092,10 @@ |
||
1092 | 1092 | return false; |
1093 | 1093 | } elseif ($this->isDateAttribute($key)) { |
1094 | 1094 | return $this->fromDateTime($current) === |
1095 | - $this->fromDateTime($original); |
|
1095 | + $this->fromDateTime($original); |
|
1096 | 1096 | } elseif ($this->hasCast($key)) { |
1097 | 1097 | return $this->castAttribute($key, $current) === |
1098 | - $this->castAttribute($key, $original); |
|
1098 | + $this->castAttribute($key, $original); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | return is_numeric($current) && is_numeric($original) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | protected function addDateAttributesToArray(array $attributes) |
122 | 122 | { |
123 | 123 | foreach ($this->getDates() as $key) { |
124 | - if (! isset($attributes[$key])) { |
|
124 | + if (!isset($attributes[$key])) { |
|
125 | 125 | continue; |
126 | 126 | } |
127 | 127 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | // We want to spin through all the mutated attributes for this model and call |
147 | 147 | // the mutator for the attribute. We cache off every mutated attributes so |
148 | 148 | // we don't have to constantly check on attributes that actually change. |
149 | - if (! array_key_exists($key, $attributes)) { |
|
149 | + if (!array_key_exists($key, $attributes)) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) |
172 | 172 | { |
173 | 173 | foreach ($this->getCasts() as $key => $value) { |
174 | - if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { |
|
174 | + if (!array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { |
|
175 | 175 | continue; |
176 | 176 | } |
177 | 177 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function getArrayableAppends() |
217 | 217 | { |
218 | - if (! count($this->appends)) { |
|
218 | + if (!count($this->appends)) { |
|
219 | 219 | return []; |
220 | 220 | } |
221 | 221 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function getAttribute($key) |
307 | 307 | { |
308 | - if (! $key) { |
|
308 | + if (!$key) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | // instance on retrieval, which makes it quite convenient to work with |
356 | 356 | // date fields without having to create a mutator for each property. |
357 | 357 | if (in_array($key, $this->getDates()) && |
358 | - ! is_null($value)) { |
|
358 | + !is_null($value)) { |
|
359 | 359 | return $this->asDateTime($value); |
360 | 360 | } |
361 | 361 | |
@@ -410,13 +410,13 @@ discard block |
||
410 | 410 | { |
411 | 411 | $relation = $this->$method(); |
412 | 412 | |
413 | - if (! $relation instanceof Relation) { |
|
413 | + if (!$relation instanceof Relation) { |
|
414 | 414 | throw new LogicException(sprintf( |
415 | 415 | '%s::%s must return a relationship instance.', static::class, $method |
416 | 416 | )); |
417 | 417 | } |
418 | 418 | |
419 | - return tap($relation->getResults(), function ($results) use ($method) { |
|
419 | + return tap($relation->getResults(), function($results) use ($method) { |
|
420 | 420 | $this->setRelation($method, $results); |
421 | 421 | }); |
422 | 422 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $value = $this->fromDateTime($value); |
554 | 554 | } |
555 | 555 | |
556 | - if ($this->isJsonCastable($key) && ! is_null($value)) { |
|
556 | + if ($this->isJsonCastable($key) && !is_null($value)) { |
|
557 | 557 | $value = $this->castAttributeAsJson($key, $value); |
558 | 558 | } |
559 | 559 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | */ |
633 | 633 | protected function getArrayAttributeWithValue($path, $key, $value) |
634 | 634 | { |
635 | - return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value) { |
|
635 | + return tap($this->getArrayAttributeByKey($key), function(&$array) use ($path, $value) { |
|
636 | 636 | Arr::set($array, str_replace('->', '.', $path), $value); |
637 | 637 | }); |
638 | 638 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function fromJson($value, $asObject = false) |
691 | 691 | { |
692 | - return json_decode($value, ! $asObject); |
|
692 | + return json_decode($value, !$asObject); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | /** |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | */ |
1000 | 1000 | public function isClean($attributes = null) |
1001 | 1001 | { |
1002 | - return ! $this->isDirty(...func_get_args()); |
|
1002 | + return !$this->isDirty(...func_get_args()); |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | $dirty = []; |
1054 | 1054 | |
1055 | 1055 | foreach ($this->getAttributes() as $key => $value) { |
1056 | - if (! $this->originalIsEquivalent($key, $value)) { |
|
1056 | + if (!$this->originalIsEquivalent($key, $value)) { |
|
1057 | 1057 | $dirty[$key] = $value; |
1058 | 1058 | } |
1059 | 1059 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | */ |
1081 | 1081 | protected function originalIsEquivalent($key, $current) |
1082 | 1082 | { |
1083 | - if (! array_key_exists($key, $this->original)) { |
|
1083 | + if (!array_key_exists($key, $this->original)) { |
|
1084 | 1084 | return false; |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | { |
1140 | 1140 | $class = static::class; |
1141 | 1141 | |
1142 | - if (! isset(static::$mutatorCache[$class])) { |
|
1142 | + if (!isset(static::$mutatorCache[$class])) { |
|
1143 | 1143 | static::cacheMutatedAttributes($class); |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | */ |
1155 | 1155 | public static function cacheMutatedAttributes($class) |
1156 | 1156 | { |
1157 | - static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function ($match) { |
|
1157 | + static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function($match){ |
|
1158 | 1158 | return lcfirst(static::$snakeAttributes ? Str::snake($match) : $match); |
1159 | 1159 | })->all(); |
1160 | 1160 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | )); |
417 | 417 | } |
418 | 418 | |
419 | - return tap($relation->getResults(), function ($results) use ($method) { |
|
419 | + return tap($relation->getResults(), function ($results) use ($method){ |
|
420 | 420 | $this->setRelation($method, $results); |
421 | 421 | }); |
422 | 422 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | */ |
633 | 633 | protected function getArrayAttributeWithValue($path, $key, $value) |
634 | 634 | { |
635 | - return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value) { |
|
635 | + return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value){ |
|
636 | 636 | Arr::set($array, str_replace('->', '.', $path), $value); |
637 | 637 | }); |
638 | 638 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | */ |
1155 | 1155 | public static function cacheMutatedAttributes($class) |
1156 | 1156 | { |
1157 | - static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function ($match) { |
|
1157 | + static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function ($match){ |
|
1158 | 1158 | return lcfirst(static::$snakeAttributes ? Str::snake($match) : $match); |
1159 | 1159 | })->all(); |
1160 | 1160 | } |