@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | if ($reference->hasFragmentKey()) { |
| 28 | 28 | if (!$field instanceof FragmentField) { |
| 29 | - throw new \RuntimeException('Field ' . $field->getKey() . ' was expected to be a fragmentfield but its not.'); |
|
| 29 | + throw new \RuntimeException('Field '.$field->getKey().' was expected to be a fragmentfield but its not.'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $firstFragment = $field->getFragments()[0]; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $genericModelInstance = $this->modelInstance(); |
| 17 | 17 | |
| 18 | 18 | // Generic model details |
| 19 | - $id = Str::slug($this->registration->key() . ($this->hasExistingModel() ? '-' . $this->existingModel()->id : '')); |
|
| 19 | + $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : '')); |
|
| 20 | 20 | $key = $this->registration->key(); |
| 21 | 21 | $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key); |
| 22 | 22 | $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key); |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | return new Details( |
| 33 | 33 | $id, |
| 34 | 34 | $key, |
| 35 | - $labelSingular . '', |
|
| 36 | - $labelPlural . '', |
|
| 35 | + $labelSingular.'', |
|
| 36 | + $labelPlural.'', |
|
| 37 | 37 | $internal_label, |
| 38 | - $title . '' |
|
| 38 | + $title.'' |
|
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | if ($request->filled('template')) { |
| 41 | 41 | $this->applyTemplate->handle( |
| 42 | 42 | ModelReference::fromString($request->input('template'))->className(), |
| 43 | - (string) ModelReference::fromString($request->input('template'))->id(), |
|
| 43 | + (string)ModelReference::fromString($request->input('template'))->id(), |
|
| 44 | 44 | get_class($manager->existingModel()), |
| 45 | - (string) $manager->existingModel()->id |
|
| 45 | + (string)$manager->existingModel()->id |
|
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -75,21 +75,21 @@ |
||
| 75 | 75 | private function validate($managerClass, $modelClass) |
| 76 | 76 | { |
| 77 | 77 | if (!class_exists($managerClass)) { |
| 78 | - throw new \InvalidArgumentException('Manager class [' . $managerClass . '] is an invalid class reference. Please make sure the class exists.'); |
|
| 78 | + throw new \InvalidArgumentException('Manager class ['.$managerClass.'] is an invalid class reference. Please make sure the class exists.'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if (!class_exists($modelClass)) { |
| 82 | - throw new \InvalidArgumentException('Model class [' . $modelClass . '] is an invalid model reference. Please make sure the class exists.'); |
|
| 82 | + throw new \InvalidArgumentException('Model class ['.$modelClass.'] is an invalid model reference. Please make sure the class exists.'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $manager = new \ReflectionClass($managerClass); |
| 86 | 86 | if (!$manager->implementsInterface(Manager::class)) { |
| 87 | - throw new \InvalidArgumentException('Class [' . $managerClass . '] is expected to implement the [' . Manager::class . '] contract.'); |
|
| 87 | + throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $model = new \ReflectionClass($modelClass); |
| 91 | 91 | if (!$model->implementsInterface(ManagedModel::class)) { |
| 92 | - throw new \InvalidArgumentException('Class [' . $modelClass . '] is expected to implement the [' . ManagedModel::class . '] contract.'); |
|
| 92 | + throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.'); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $registrations = collect($this->register->filterByTag($tag)->all()); |
| 52 | 52 | |
| 53 | - return $registrations->map(function ($registration) { |
|
| 53 | + return $registrations->map(function($registration) { |
|
| 54 | 54 | return $this->instance($registration); |
| 55 | 55 | }); |
| 56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $registrations = collect($this->register->filterByTag($tag)->all()); |
| 67 | 67 | |
| 68 | - return $registrations->map(function ($registration) { |
|
| 68 | + return $registrations->map(function($registration) { |
|
| 69 | 69 | return $this->instance($registration)->details(); |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | //return array with group name and values |
| 77 | 77 | $grouped = []; |
| 78 | 78 | |
| 79 | - $managers = $managers->map(function (Manager $item) { |
|
| 79 | + $managers = $managers->map(function(Manager $item) { |
|
| 80 | 80 | return [ |
| 81 | 81 | 'id' => $item->details()->id, |
| 82 | 82 | 'group' => $item->details()->plural, |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $registrations = collect($this->register->all()); |
| 92 | 92 | |
| 93 | - return $registrations->map(function ($registration) { |
|
| 93 | + return $registrations->map(function($registration) { |
|
| 94 | 94 | return $this->instance($registration); |
| 95 | 95 | }); |
| 96 | 96 | } |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | private function registrationMustExistConstraint(string $key, $value, $registrations): void |
| 137 | 137 | { |
| 138 | 138 | if (empty($registrations) && count($registrations) != $this->registrations) { |
| 139 | - throw new NonRegisteredManager('No manager found for ' . $key . ' [' . print_r($value, true) . ']. Did you perhaps forgot to register the manager?'); |
|
| 139 | + throw new NonRegisteredManager('No manager found for '.$key.' ['.print_r($value, true).']. Did you perhaps forgot to register the manager?'); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function assistant(string $assistantKey): Assistant |
| 52 | 52 | { |
| 53 | 53 | if (!$this->isAssistedBy($assistantKey)) { |
| 54 | - throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . static::class); |
|
| 54 | + throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.static::class); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $instance = app($this->getAssistantClass($assistantKey)); |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | |
| 36 | 36 | public function toReference(): SetReference |
| 37 | 37 | { |
| 38 | - $reference = SetReference::all()->first(function ($setReference) { |
|
| 38 | + $reference = SetReference::all()->first(function($setReference) { |
|
| 39 | 39 | return $setReference->key() == $this->key; |
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | if (!$reference) { |
| 43 | - throw new \Exception('No query set found by key [' . $this->key . ']. Make sure that this ' . $this->key . ' set is added to the chief.sets config array.'); |
|
| 43 | + throw new \Exception('No query set found by key ['.$this->key.']. Make sure that this '.$this->key.' set is added to the chief.sets config array.'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return $reference; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function apply($value = null): Closure |
| 21 | 21 | { |
| 22 | - return function ($query) use ($value) { |
|
| 22 | + return function($query) use ($value) { |
|
| 23 | 23 | if ($value == 'all') { |
| 24 | 24 | return $query; |
| 25 | 25 | } |