@@ -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 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $types = []; |
| 67 | 67 | |
| 68 | - if($onlySingles) |
|
| 68 | + if ($onlySingles) |
|
| 69 | 69 | { |
| 70 | 70 | $types = ['singles']; |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | public static function modelsByType(array $types, Model $ignoredModel = null, $online = true) |
| 78 | 78 | { |
| 79 | - $models = chiefMemoize('all-online-models', function () use ($types, $online) { |
|
| 79 | + $models = chiefMemoize('all-online-models', function() use ($types, $online) { |
|
| 80 | 80 | $builder = UrlRecord::whereNull('redirect_id') |
| 81 | 81 | ->select('model_type', 'model_id') |
| 82 | 82 | ->groupBy('model_type', 'model_id'); |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | $builder->whereIn('model_type', $types); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return $builder->get()->mapToGroups(function ($record) { |
|
| 88 | + return $builder->get()->mapToGroups(function($record) { |
|
| 89 | 89 | return [$record->model_type => $record->model_id]; |
| 90 | - })->map(function ($record, $key) { |
|
| 90 | + })->map(function($record, $key) { |
|
| 91 | 91 | return Morphables::instance($key)->find($record->toArray()); |
| 92 | - })->map->reject(function ($model) use ($online) { |
|
| 92 | + })->map->reject(function($model) use ($online) { |
|
| 93 | 93 | if ($online) { |
| 94 | 94 | return is_null($model) || !$model->isPublished(); |
| 95 | 95 | } // Invalid references to archived or removed models where url record still exists. |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | 101 | if ($ignoredModel) { |
| 102 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
| 102 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
| 103 | 103 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
| 104 | 104 | }); |
| 105 | 105 | } |