@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public static function toSelectValues(Collection $collection): Collection |
10 | 10 | { |
11 | - return $collection->map(function (ProvidesFlatReference $item) { |
|
11 | + return $collection->map(function(ProvidesFlatReference $item) { |
|
12 | 12 | return [ |
13 | 13 | 'id' => $item->flatReference()->get(), |
14 | 14 | 'label' => $item->flatReferenceLabel(), |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | { |
22 | 22 | $grouped = []; |
23 | 23 | |
24 | - static::toSelectValues($collection)->each(function ($item) use (&$grouped) { |
|
24 | + static::toSelectValues($collection)->each(function($item) use (&$grouped) { |
|
25 | 25 | if (isset($grouped[$item['group']])) { |
26 | 26 | $grouped[$item['group']]['values'][] = $item; |
27 | - } else { |
|
27 | + }else { |
|
28 | 28 | $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]]; |
29 | 29 | } |
30 | 30 | }); |
@@ -21,16 +21,16 @@ |
||
21 | 21 | $referenceStrings = []; |
22 | 22 | } |
23 | 23 | |
24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
25 | 25 | return is_null($referenceString); |
26 | - })->map(function ($referenceString) { |
|
26 | + })->map(function($referenceString) { |
|
27 | 27 | return FlatReferenceFactory::fromString($referenceString)->instance(); |
28 | 28 | }); |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function toFlatReferences(): Collection |
32 | 32 | { |
33 | - return (new Collection($this->all()))->map(function (ProvidesFlatReference $item) { |
|
33 | + return (new Collection($this->all()))->map(function(ProvidesFlatReference $item) { |
|
34 | 34 | return $item->flatReference()->get(); |
35 | 35 | }); |
36 | 36 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | public static function fromString(string $reference): FlatReference |
8 | 8 | { |
9 | 9 | if (false == strpos($reference, '@')) { |
10 | - throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. [' . $reference . '] was passed instead.'); |
|
10 | + throw new \InvalidArgumentException('Invalid reference composition. A flat reference should honour schema <class>@<id>. ['.$reference.'] was passed instead.'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | list($className, $id) = explode('@', $reference); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | $instance = app($className); |
16 | 16 | $instance->{$instance->getKeyName()} = $id; |
17 | 17 | |
18 | - if (! method_exists($instance, 'flatReference')) { |
|
19 | - throw new \InvalidArgumentException('Instance created from model reference [' . $reference . '] was expected to have a method of flatReference() but is has not.'); |
|
18 | + if (!method_exists($instance, 'flatReference')) { |
|
19 | + throw new \InvalidArgumentException('Instance created from model reference ['.$reference.'] was expected to have a method of flatReference() but is has not.'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | return $instance->flatReference(); |
@@ -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 | } |
@@ -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; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public static function rolesForSelect($includeDeveloperRole = false) |
20 | 20 | { |
21 | - $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) { |
|
21 | + $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) { |
|
22 | 22 | return $role->name == 'developer'; |
23 | 23 | }); |
24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getPermissionsForIndex() |
41 | 41 | { |
42 | - $this->permissions->each(function ($permission) { |
|
42 | + $this->permissions->each(function($permission) { |
|
43 | 43 | $model = explode("_", $permission->name, 2)[1]; |
44 | 44 | $temp = $this->permission; |
45 | 45 | $temp[$model][] = explode("_", $permission->name, 2)[0]; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function apply($value = null): Closure |
17 | 17 | { |
18 | - return $this->query && $this->query instanceof Closure ? $this->query : function ($query) { |
|
18 | + return $this->query && $this->query instanceof Closure ? $this->query : function($query) { |
|
19 | 19 | return $query; |
20 | 20 | }; |
21 | 21 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
5 | 5 |