@@ -177,7 +177,7 @@ |
||
177 | 177 | */ |
178 | 178 | protected function newRelatedInstance($class) |
179 | 179 | { |
180 | - return take(new $class, function ($instance) { |
|
180 | + return take(new $class, function($instance) { |
|
181 | 181 | if ( ! $instance->getConnectionName()) { |
182 | 182 | $instance->setConnection($this->connection); |
183 | 183 | } |
@@ -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 |