@@ -39,11 +39,11 @@ |
||
39 | 39 | protected $attributes = []; |
40 | 40 | |
41 | 41 | /** |
42 | - * The model attribute's original state. |
|
43 | - * |
|
44 | - * @var array $original |
|
45 | - */ |
|
46 | - protected $original = []; |
|
42 | + * The model attribute's original state. |
|
43 | + * |
|
44 | + * @var array $original |
|
45 | + */ |
|
46 | + protected $original = []; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Indicates whether attributes are snake cased on arrays. |
@@ -44,11 +44,11 @@ |
||
44 | 44 | protected $observables = []; |
45 | 45 | |
46 | 46 | /** |
47 | - * The event dispatcher instance. |
|
48 | - * |
|
49 | - * @var \Syscodes\Components\Contracts\Events\Dispatcher $dispatcher |
|
50 | - */ |
|
51 | - protected static $dispatcher; |
|
47 | + * The event dispatcher instance. |
|
48 | + * |
|
49 | + * @var \Syscodes\Components\Contracts\Events\Dispatcher $dispatcher |
|
50 | + */ |
|
51 | + protected static $dispatcher; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Get the observable event names. |
@@ -47,6 +47,6 @@ |
||
47 | 47 | */ |
48 | 48 | protected function getDefaultFor(Model $parent) |
49 | 49 | { |
50 | - return $this->newRelatedInstanceFor($parent); |
|
50 | + return $this->newRelatedInstanceFor($parent); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -71,9 +71,9 @@ |
||
71 | 71 | $instance = new static; |
72 | 72 | |
73 | 73 | $instance->setConnection($parent->getConnectionName()) |
74 | - ->setTable($table) |
|
75 | - ->fill($attributes) |
|
76 | - ->syncOriginal(); |
|
74 | + ->setTable($table) |
|
75 | + ->fill($attributes) |
|
76 | + ->syncOriginal(); |
|
77 | 77 | |
78 | 78 | $instance->pivotParent = $parent; |
79 | 79 |
@@ -142,7 +142,7 @@ |
||
142 | 142 | return 0; |
143 | 143 | } |
144 | 144 | |
145 | - return take($this->getDeleteQuery()->delete(), function () { |
|
145 | + return take($this->getDeleteQuery()->delete(), function() { |
|
146 | 146 | $this->exists = false; |
147 | 147 | |
148 | 148 | $this->fireModelEvent('deleted', false); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | protected function formatSyncList(array $records): array |
75 | 75 | { |
76 | - return collect($records)->mapKeys(function ($attributes, $id) { |
|
76 | + return collect($records)->mapKeys(function($attributes, $id) { |
|
77 | 77 | if ( ! is_array($attributes)) { |
78 | 78 | list($id, $attributes) = [$attributes, []]; |
79 | 79 | } |
@@ -220,7 +220,9 @@ |
||
220 | 220 | if ( ! is_null($ids)) { |
221 | 221 | $ids = $this->parseWithIds($ids); |
222 | 222 | |
223 | - if (empty($ids)) return 0; |
|
223 | + if (empty($ids)) { |
|
224 | + return 0; |
|
225 | + } |
|
224 | 226 | |
225 | 227 | $query->whereIn($this->relatedKey, $ids); |
226 | 228 | } |
@@ -179,10 +179,10 @@ |
||
179 | 179 | protected function getKeys(array $models, $key = null): array |
180 | 180 | { |
181 | 181 | return collect($models)->map(fn ($value) => $key ? $value->getAttribute($key) : $value->getKey()) |
182 | - ->values() |
|
183 | - ->unique(null, true) |
|
184 | - ->sort() |
|
185 | - ->all(); |
|
182 | + ->values() |
|
183 | + ->unique(null, true) |
|
184 | + ->sort() |
|
185 | + ->all(); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -143,7 +143,7 @@ |
||
143 | 143 | |
144 | 144 | foreach ($models as $model) { |
145 | 145 | if ( ! is_null($value = $model->{$this->foreignKey})) { |
146 | - $keys[]= $value; |
|
146 | + $keys[] = $value; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $defaults = [$this->foreignPivotKey, $this->relatedKey]; |
246 | 246 | |
247 | - return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { |
|
247 | + return collect(array_merge($defaults, $this->pivotColumns))->map(function($column) { |
|
248 | 248 | return $this->qualifyPivotColumn($column).' as pivot_'.$column; |
249 | 249 | })->unique()->all(); |
250 | 250 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @return static |
559 | 559 | */ |
560 | - public function wherePivotNull($column, $boolean = 'and', $negative = false): static |
|
560 | + public function wherePivotNull($column, $boolean = 'and', $negative = false): static |
|
561 | 561 | { |
562 | 562 | $this->pivotWhereNulls[] = func_get_args(); |
563 | 563 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | if (count($result) === count(array_unique($id))) { |
748 | 748 | return $result; |
749 | 749 | } |
750 | - } elseif (! is_null($result)) { |
|
750 | + } elseif ( ! is_null($result)) { |
|
751 | 751 | return $result; |
752 | 752 | } |
753 | 753 |
@@ -585,8 +585,8 @@ |
||
585 | 585 | protected function buildNotInstantiable(string $class): mixed |
586 | 586 | { |
587 | 587 | if ( ! empty($this->buildStack)) { |
588 | - $reset = implode(', ', $this->buildStack); |
|
589 | - $message = "Target [{$class}] is not instantiable while building [{$reset}]"; |
|
588 | + $reset = implode(', ', $this->buildStack); |
|
589 | + $message = "Target [{$class}] is not instantiable while building [{$reset}]"; |
|
590 | 590 | } else { |
591 | 591 | $message = "Target [{$class}] is not instantiable"; |
592 | 592 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return void |
212 | 212 | */ |
213 | - public function bind($id, Closure|string $value = null, bool $singleton = false): void |
|
213 | + public function bind($id, Closure | string $value = null, bool $singleton = false): void |
|
214 | 214 | { |
215 | 215 | $this->dropInstances($id); |
216 | 216 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected function getClosure($id, string $value): mixed |
257 | 257 | { |
258 | - return function ($container, $parameters = []) use ($id, $value) { |
|
258 | + return function($container, $parameters = []) use ($id, $value) { |
|
259 | 259 | if ($id == $value) { |
260 | 260 | return $container->build($value); |
261 | 261 | } |
@@ -173,7 +173,9 @@ |
||
173 | 173 | { |
174 | 174 | $this->hasCallbacks[$id = $this->getAlias($id)][] = $callback; |
175 | 175 | |
176 | - if ($this->bound($id)) return $this->make($id); |
|
176 | + if ($this->bound($id)) { |
|
177 | + return $this->make($id); |
|
178 | + } |
|
177 | 179 | } |
178 | 180 | |
179 | 181 | /** |