@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function onlineModels(bool $onlySingles = false, Model $ignoredModel = null): Collection |
| 41 | 41 | { |
| 42 | - $models = chiefMemoize('all-online-models', function () use ($onlySingles) { |
|
| 42 | + $models = chiefMemoize('all-online-models', function() use ($onlySingles) { |
|
| 43 | 43 | $builder = UrlRecord::whereNull('redirect_id') |
| 44 | 44 | ->select('model_type', 'model_id') |
| 45 | 45 | ->groupBy('model_type', 'model_id'); |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | $builder->where('model_type', 'singles'); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - return $builder->get()->mapToGroups(function ($record) { |
|
| 51 | + return $builder->get()->mapToGroups(function($record) { |
|
| 52 | 52 | return [$record->model_type => $record->model_id]; |
| 53 | - })->map(function ($record, $key) { |
|
| 53 | + })->map(function($record, $key) { |
|
| 54 | 54 | return Morphables::instance($key)->find($record->toArray()); |
| 55 | - })->map->reject(function ($model) { |
|
| 55 | + })->map->reject(function($model) { |
|
| 56 | 56 | return is_null($model) || !$model->isPublished(); // Invalid references to archived or removed models where url record still exists. |
| 57 | 57 | })->flatten(); |
| 58 | 58 | }, [$onlySingles]); |
| 59 | 59 | |
| 60 | 60 | if ($ignoredModel) { |
| 61 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
| 61 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
| 62 | 62 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\Fields\Types; |
| 6 | 6 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - return 'files['. ($this->values['name'] ?? $this->key()).']'; |
|
| 43 | + return 'files['.($this->values['name'] ?? $this->key()).']'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function sluggifyName() |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $images = []; |
| 59 | 59 | $locale = $locale ?? app()->getLocale(); |
| 60 | 60 | |
| 61 | - $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function ($asset) use ($locale) { |
|
| 61 | + $assets = $model->assetRelation->where('pivot.type', $this->key())->filter(function($asset) use ($locale) { |
|
| 62 | 62 | return $asset->pivot->locale == $locale; |
| 63 | 63 | })->sortBy('pivot.order'); |
| 64 | 64 | |