@@ -6,22 +6,22 @@ |
||
6 | 6 | |
7 | 7 | class FieldType |
8 | 8 | { |
9 | - const INPUT = 'input'; // oneliner text (input) |
|
10 | - const TEXT = 'text'; // Plain text (textarea) |
|
11 | - const NUMBER = 'number'; // number |
|
12 | - const RANGE = 'range'; // range slider |
|
13 | - const DATE = 'date'; // Timestamp input |
|
14 | - const PHONENUMBER = 'phonenumber'; // Timestamp input |
|
15 | - const HTML = 'html'; // Html text (wysiwyg) |
|
16 | - const SELECT = 'select'; // Select options |
|
9 | + const INPUT = 'input'; // oneliner text (input) |
|
10 | + const TEXT = 'text'; // Plain text (textarea) |
|
11 | + const NUMBER = 'number'; // number |
|
12 | + const RANGE = 'range'; // range slider |
|
13 | + const DATE = 'date'; // Timestamp input |
|
14 | + const PHONENUMBER = 'phonenumber'; // Timestamp input |
|
15 | + const HTML = 'html'; // Html text (wysiwyg) |
|
16 | + const SELECT = 'select'; // Select options |
|
17 | 17 | //const MEDIA = 'media'; // media file |
18 | - const FILE = 'file'; // regular file |
|
19 | - const IMAGE = 'image'; // image (slim uploader) |
|
20 | - const DOCUMENT = 'document'; // documents |
|
21 | - const RADIO = 'radio'; // radio select |
|
22 | - const CHECKBOX = 'checkbox'; // checkbox select |
|
23 | - const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
24 | - const PAGE = 'page'; // select a page (also a special field) |
|
18 | + const FILE = 'file'; // regular file |
|
19 | + const IMAGE = 'image'; // image (slim uploader) |
|
20 | + const DOCUMENT = 'document'; // documents |
|
21 | + const RADIO = 'radio'; // radio select |
|
22 | + const CHECKBOX = 'checkbox'; // checkbox select |
|
23 | + const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
24 | + const PAGE = 'page'; // select a page (also a special field) |
|
25 | 25 | |
26 | 26 | /** @var string */ |
27 | 27 | private $type; |
@@ -20,14 +20,14 @@ |
||
20 | 20 | |
21 | 21 | public function options(array $morphKeys = []) |
22 | 22 | { |
23 | - if (! empty($morphKeys)) { |
|
24 | - $morphKeys = collect($morphKeys)->map(function ($key) { |
|
23 | + if (!empty($morphKeys)) { |
|
24 | + $morphKeys = collect($morphKeys)->map(function($key) { |
|
25 | 25 | return (new $key())->getMorphClass(); |
26 | 26 | }); |
27 | 27 | |
28 | 28 | $pages = UrlHelper::modelsByType($morphKeys->toArray())->get(); |
29 | 29 | $pages = FlatReferencePresenter::toGroupedSelectValues($pages)->toArray(); |
30 | - } else { |
|
30 | + }else { |
|
31 | 31 | $pages = UrlHelper::allModelsWithoutSelf($this->model); |
32 | 32 | } |
33 | 33 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public static function modelsByType(array $types, Model $ignoredModel = null, $online = true) |
77 | 77 | { |
78 | - $models = chiefMemoize('all-online-models', function () use ($types, $online) { |
|
78 | + $models = chiefMemoize('all-online-models', function() use ($types, $online) { |
|
79 | 79 | $builder = UrlRecord::whereNull('redirect_id') |
80 | 80 | ->select('model_type', 'model_id') |
81 | 81 | ->groupBy('model_type', 'model_id'); |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | $builder->whereIn('model_type', $types); |
85 | 85 | } |
86 | 86 | |
87 | - return $builder->get()->mapToGroups(function ($record) { |
|
87 | + return $builder->get()->mapToGroups(function($record) { |
|
88 | 88 | return [$record->model_type => $record->model_id]; |
89 | - })->map(function ($record, $key) { |
|
89 | + })->map(function($record, $key) { |
|
90 | 90 | return Morphables::instance($key)->find($record->toArray()); |
91 | - })->map->reject(function ($model) use ($online) { |
|
91 | + })->map->reject(function($model) use ($online) { |
|
92 | 92 | if ($online) { |
93 | 93 | return is_null($model) || !$model->isPublished(); |
94 | 94 | } // Invalid references to archived or removed models where url record still exists. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | }); |
99 | 99 | |
100 | 100 | if ($ignoredModel) { |
101 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
101 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
102 | 102 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
103 | 103 | }); |
104 | 104 | } |