@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | return $this->indexPagination($builder); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return $builder->get()->map(function ($model) { |
|
| 90 | + return $builder->get()->map(function($model) { |
|
| 91 | 91 | return (new static($this->registration))->manage($model); |
| 92 | 92 | }); |
| 93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $paginator = $builder->paginate($this->pageCount); |
| 117 | 117 | |
| 118 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
| 118 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
| 119 | 119 | return (new static($this->registration))->manage($model); |
| 120 | 120 | }); |
| 121 | 121 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | public function guard($verb): Manager |
| 194 | 194 | { |
| 195 | - if (! $this->can($verb)) { |
|
| 195 | + if (!$this->can($verb)) { |
|
| 196 | 196 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $fields = $this->fields(); |
| 216 | 216 | |
| 217 | 217 | foreach ($this->assistants() as $assistant) { |
| 218 | - if (! method_exists($assistant, 'fields')) { |
|
| 218 | + if (!method_exists($assistant, 'fields')) { |
|
| 219 | 219 | continue; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | public function delete() |
| 243 | 243 | { |
| 244 | - if($this->model instanceof ActsAsChild) { |
|
| 244 | + if ($this->model instanceof ActsAsChild) { |
|
| 245 | 245 | $this->model->detachAllParentRelations(); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if($this->model instanceof ActsAsParent) { |
|
| 248 | + if ($this->model instanceof ActsAsParent) { |
|
| 249 | 249 | $this->model->detachAllChildRelations(); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -305,9 +305,9 @@ discard block |
||
| 305 | 305 | static::$bootedTraitMethods[$baseMethod] = []; |
| 306 | 306 | |
| 307 | 307 | foreach (class_uses_recursive($class) as $trait) { |
| 308 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
| 308 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
| 309 | 309 | |
| 310 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
| 310 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
| 311 | 311 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ->orderBy('sort', 'ASC') |
| 47 | 47 | ->get(); |
| 48 | 48 | |
| 49 | - return $relations->map(function (Relation $relation) { |
|
| 49 | + return $relations->map(function(Relation $relation) { |
|
| 50 | 50 | $parent = $relation->parent; |
| 51 | 51 | $parent->relation = $relation; |
| 52 | 52 | return $parent; |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | ->orderBy('sort', 'ASC') |
| 61 | 61 | ->get(); |
| 62 | 62 | |
| 63 | - return $relations->map(function (Relation $relation) use ($parent_type, $parent_id) { |
|
| 63 | + return $relations->map(function(Relation $relation) use ($parent_type, $parent_id) { |
|
| 64 | 64 | |
| 65 | 65 | // It could be that the child itself is soft-deleted, if this is the case, we will ignore it and move on. |
| 66 | 66 | if (!$child = $relation->child) { |
| 67 | 67 | if (!$relation->child()->withTrashed()->first()) { |
| 68 | 68 | // if ((!method_exists($childInstance, 'trashed')) || ! $childInstance->onlyTrashed()->find($relation->child_id)) { |
| 69 | 69 | // If we cannot retrieve it then he collection type is possibly off, this is a database inconsistency and should be addressed |
| 70 | - throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent [' . $parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.'); |
|
| 70 | + throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent ['.$parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return null; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | }) |
| 80 | 80 | |
| 81 | 81 | // In case of soft-deleted entries, this will be null and should be ignored. We make sure that keys are reset in case of removed child |
| 82 | - ->reject(function ($child) { |
|
| 82 | + ->reject(function($child) { |
|
| 83 | 83 | return is_null($child); |
| 84 | 84 | }) |
| 85 | 85 | ->values(); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public static function deleteRelationsOf($type, $id) |
| 98 | 98 | { |
| 99 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 99 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 100 | 100 | return $query->where('parent_type', $type) |
| 101 | 101 | ->where('parent_id', $id); |
| 102 | - })->orWhere(function ($query) use ($type, $id) { |
|
| 102 | + })->orWhere(function($query) use ($type, $id) { |
|
| 103 | 103 | return $query->where('child_type', $type) |
| 104 | 104 | ->where('child_id', $id); |
| 105 | 105 | })->get(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | public static function deleteAllChildRelationsOf($type, $id) |
| 113 | 113 | { |
| 114 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 114 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 115 | 115 | return $query->where('parent_type', $type) |
| 116 | 116 | ->where('parent_id', $id); |
| 117 | 117 | })->get(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public static function deleteAllParentRelationsOf($type, $id) |
| 125 | 125 | { |
| 126 | - $relations = static::where(function ($query) use ($type, $id) { |
|
| 126 | + $relations = static::where(function($query) use ($type, $id) { |
|
| 127 | 127 | return $query->where('child_type', $type) |
| 128 | 128 | ->where('child_id', $id); |
| 129 | 129 | })->get(); |