@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | Event::listen( |
| 29 | 29 | RelationMorphFromModelWasCleaned::class, |
| 30 | - function (RelationMorphFromModelWasCleaned $event) { |
|
| 30 | + function(RelationMorphFromModelWasCleaned $event) { |
|
| 31 | 31 | $this->info(sprintf( |
| 32 | 32 | "\tâ Clean model %s in the table %s: %d %s.", |
| 33 | 33 | get_class($event->model), |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | protected static function bootCascadeDelete() |
| 14 | 14 | { |
| 15 | - static::deleted(function ($model) { |
|
| 15 | + static::deleted(function($model) { |
|
| 16 | 16 | $morph = new Morph(); |
| 17 | 17 | |
| 18 | 18 | $morph->delete($model); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function getCascadeDeleteMorph() |
| 28 | 28 | { |
| 29 | - return (array) ($this->cascadeDeleteMorph ?? []); |
|
| 29 | + return (array) ($this->cascadeDeleteMorph ?? [ ]); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $this->load(); |
| 86 | 86 | |
| 87 | 87 | return array_map( |
| 88 | - function ($modelName) { |
|
| 88 | + function($modelName) { |
|
| 89 | 89 | return new $modelName; |
| 90 | 90 | }, |
| 91 | 91 | $this->getModelsNameWithCascadeDeleteTrait() |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function queryCleanOrphan(Model $parentModel, Relation $relation, bool $dryRun = false) |
| 104 | 104 | { |
| 105 | - [$childTable, $childFieldType, $childFieldId] = $this->getStructureMorphRelation($relation); |
|
| 105 | + [ $childTable, $childFieldType, $childFieldId ] = $this->getStructureMorphRelation($relation); |
|
| 106 | 106 | |
| 107 | 107 | $method = $dryRun ? 'count' : 'delete'; |
| 108 | 108 | |
| 109 | 109 | return DB::table($childTable) |
| 110 | 110 | ->where($childFieldType, $parentModel->getMorphClass()) |
| 111 | - ->whereNotExists(function ($query) use ( |
|
| 111 | + ->whereNotExists(function($query) use ( |
|
| 112 | 112 | $parentModel, |
| 113 | 113 | $childTable, |
| 114 | 114 | $childFieldId |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $fieldId = $relation->getForeignPivotKeyName(); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - return [$table, $fieldType, $fieldId]; |
|
| 142 | + return [ $table, $fieldType, $fieldId ]; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | return array_filter( |
| 153 | 153 | get_declared_classes(), |
| 154 | - function ($class) { |
|
| 154 | + function($class) { |
|
| 155 | 155 | return array_key_exists( |
| 156 | 156 | CascadeDelete::class, |
| 157 | 157 | class_uses($class) |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | return array_filter( |
| 172 | 172 | array_map( |
| 173 | - function ($methodName) use ($model) { |
|
| 173 | + function($methodName) use ($model) { |
|
| 174 | 174 | return $this->methodReturnedMorphRelation($model, $methodName); |
| 175 | 175 | }, |
| 176 | 176 | $model->getCascadeDeleteMorph() |
| 177 | 177 | ), |
| 178 | - function ($relation) { |
|
| 178 | + function($relation) { |
|
| 179 | 179 | return $relation; |
| 180 | 180 | } |
| 181 | 181 | ); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | protected function methodReturnedMorphRelation($model, $methodName) |
| 192 | 192 | { |
| 193 | - if (! method_exists($model, $methodName)) { |
|
| 193 | + if (!method_exists($model, $methodName)) { |
|
| 194 | 194 | return; |
| 195 | 195 | } |
| 196 | 196 | |