@@ -32,7 +32,7 @@ discard block  | 
                                                    ||
| 32 | 32 | $this->manager = $manager;  | 
                                                        
| 33 | 33 | $this->model = $manager->existingModel();  | 
                                                        
| 34 | 34 | |
| 35 | -        if(!$this->model instanceof StatefulContract){ | 
                                                        |
| 35 | +        if (!$this->model instanceof StatefulContract) { | 
                                                        |
| 36 | 36 |              throw new \InvalidArgumentException('PublishAssistant requires the model to implement the StatefulContract.'); | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -73,7 +73,7 @@ discard block  | 
                                                    ||
| 73 | 73 | |
| 74 | 74 | public function findAll(): Collection  | 
                                                        
| 75 | 75 |      { | 
                                                        
| 76 | -        return $this->model->published()->get()->map(function ($model) { | 
                                                        |
| 76 | +        return $this->model->published()->get()->map(function($model) { | 
                                                        |
| 77 | 77 | return $this->managers->findByModel($model);  | 
                                                        
| 78 | 78 | });  | 
                                                        
| 79 | 79 | }  | 
                                                        
@@ -95,7 +95,7 @@ discard block  | 
                                                    ||
| 95 | 95 | |
| 96 | 96 | private function guard($verb): Assistant  | 
                                                        
| 97 | 97 |      { | 
                                                        
| 98 | -        if (! $this->can($verb)) { | 
                                                        |
| 98 | +        if (!$this->can($verb)) { | 
                                                        |
| 99 | 99 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager);  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | |
@@ -120,10 +120,10 @@ discard block  | 
                                                    ||
| 120 | 120 | $class = 'text-warning';  | 
                                                        
| 121 | 121 | }  | 
                                                        
| 122 | 122 | |
| 123 | - $statusAsLabel = '<span class="font-bold '. $class .'"><em>' . $label . '</em></span>';  | 
                                                        |
| 123 | + $statusAsLabel = '<span class="font-bold '.$class.'"><em>'.$label.'</em></span>';  | 
                                                        |
| 124 | 124 | |
| 125 | 125 |          if (!$plain && $this->hasPreviewUrl()) { | 
                                                        
| 126 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>';  | 
                                                        |
| 126 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>';  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | 129 | return $statusAsLabel;  | 
                                                        
@@ -25,10 +25,10 @@ discard block  | 
                                                    ||
| 25 | 25 | |
| 26 | 26 | public function manager(Manager $manager)  | 
                                                        
| 27 | 27 |      { | 
                                                        
| 28 | - $this->manager = $manager;  | 
                                                        |
| 28 | + $this->manager = $manager;  | 
                                                        |
| 29 | 29 | |
| 30 | -        if (! $manager->existingModel() instanceof ProvidesUrl) { | 
                                                        |
| 31 | -            throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.'); | 
                                                        |
| 30 | +        if (!$manager->existingModel() instanceof ProvidesUrl) { | 
                                                        |
| 31 | +            throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.'); | 
                                                        |
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
| 34 | 34 | $this->model = $manager->existingModel();  | 
                                                        
@@ -63,7 +63,7 @@ discard block  | 
                                                    ||
| 63 | 63 | 'url-slugs.*' => 'taalspecifieke link',  | 
                                                        
| 64 | 64 | ])  | 
                                                        
| 65 | 65 |                  ->view('chief::back._fields.url-slugs') | 
                                                        
| 66 | - ->viewData(['fields' => UrlSlugFields::fromModel($this->model) ]),  | 
                                                        |
| 66 | + ->viewData(['fields' => UrlSlugFields::fromModel($this->model)]),  | 
                                                        |
| 67 | 67 | ]);  | 
                                                        
| 68 | 68 | }  | 
                                                        
| 69 | 69 | |
@@ -73,9 +73,9 @@ discard block  | 
                                                    ||
| 73 | 73 | |
| 74 | 74 | // Push update to homepage setting value  | 
                                                        
| 75 | 75 | // TODO: we should just fetch the homepages and push that instead...  | 
                                                        
| 76 | -        UrlRecord::getByModel($this->model)->reject(function ($record) { | 
                                                        |
| 76 | +        UrlRecord::getByModel($this->model)->reject(function($record) { | 
                                                        |
| 77 | 77 | return ($record->isRedirect() || !$record->isHomepage());  | 
                                                        
| 78 | -        })->each(function ($record) { | 
                                                        |
| 78 | +        })->each(function($record) { | 
                                                        |
| 79 | 79 | app(ChangeHomepage::class)->onUrlChanged($record);  | 
                                                        
| 80 | 80 | });  | 
                                                        
| 81 | 81 | }  | 
                                                        
@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 | |
| 36 | 36 | public function manager(Manager $manager)  | 
                                                        
| 37 | 37 |      { | 
                                                        
| 38 | - $this->manager = $manager;  | 
                                                        |
| 38 | + $this->manager = $manager;  | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | public function isArchived(): bool  | 
                                                        
@@ -50,7 +50,7 @@ discard block  | 
                                                    ||
| 50 | 50 | |
| 51 | 51 | public function findAllArchived(): Collection  | 
                                                        
| 52 | 52 |      { | 
                                                        
| 53 | -        return $this->manager->modelClass()::archived()->get()->map(function ($model) { | 
                                                        |
| 53 | +        return $this->manager->modelClass()::archived()->get()->map(function($model) { | 
                                                        |
| 54 | 54 | return $this->managers->findByModel($model);  | 
                                                        
| 55 | 55 | });  | 
                                                        
| 56 | 56 | }  | 
                                                        
@@ -58,7 +58,7 @@ discard block  | 
                                                    ||
| 58 | 58 | public function route($verb): ?string  | 
                                                        
| 59 | 59 |      { | 
                                                        
| 60 | 60 | $routes = [  | 
                                                        
| 61 | -            'index' => route('chief.back.assistants.view', [$this->key(),'index', $this->manager->managerKey()]), | 
                                                        |
| 61 | +            'index' => route('chief.back.assistants.view', [$this->key(), 'index', $this->manager->managerKey()]), | 
                                                        |
| 62 | 62 | ];  | 
                                                        
| 63 | 63 | |
| 64 | 64 |          if (array_key_exists($verb, $routes)) { | 
                                                        
@@ -80,11 +80,11 @@ discard block  | 
                                                    ||
| 80 | 80 | |
| 81 | 81 | private function guard($verb): Assistant  | 
                                                        
| 82 | 82 |      { | 
                                                        
| 83 | -        if(!$this->manager->existingModel() instanceof StatefulContract){ | 
                                                        |
| 83 | +        if (!$this->manager->existingModel() instanceof StatefulContract) { | 
                                                        |
| 84 | 84 |              throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract. ['.get_class($this->model).'] given instead.'); | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | |
| 87 | -        if (! $this->can($verb)) { | 
                                                        |
| 87 | +        if (!$this->can($verb)) { | 
                                                        |
| 88 | 88 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager);  | 
                                                        
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | |
| 112 | 112 | // Ok now get all urls from this model and point them to the new records  | 
                                                        
| 113 | 113 |              foreach (UrlRecord::getByModel($this->manager->existingModel()) as $urlRecord) { | 
                                                        
| 114 | -                if ($targetRecord = $targetRecords->first(function ($record) use ($urlRecord) { | 
                                                        |
| 114 | +                if ($targetRecord = $targetRecords->first(function($record) use ($urlRecord) { | 
                                                        |
| 115 | 115 | return ($record->locale == $urlRecord->locale && !$record->isRedirect());  | 
                                                        
| 116 | 116 |                  })) { | 
                                                        
| 117 | 117 | $urlRecord->redirectTo($targetRecord);  | 
                                                        
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | |
| 122 | 122 | app(ArchiveManagedModel::class)->handle($this->manager->existingModel());  | 
                                                        
| 123 | 123 | |
| 124 | -        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is gearchiveerd.'); | 
                                                        |
| 124 | +        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is gearchiveerd.'); | 
                                                        |
| 125 | 125 | }  | 
                                                        
| 126 | 126 | |
| 127 | 127 | public function unarchive()  | 
                                                        
@@ -130,6 +130,6 @@ discard block  | 
                                                    ||
| 130 | 130 | |
| 131 | 131 | app(UnArchiveManagedModel::class)->handle($this->manager->existingModel());  | 
                                                        
| 132 | 132 | |
| 133 | -        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title .' is hersteld.'); | 
                                                        |
| 133 | +        return redirect()->to($this->manager->route('index'))->with('messages.success', $this->manager->details()->title.' is hersteld.'); | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | }  | 
                                                        
@@ -17,7 +17,7 @@  | 
                                                    ||
| 17 | 17 | $genericModelInstance = new $className;  | 
                                                        
| 18 | 18 | |
| 19 | 19 | // Generic model details  | 
                                                        
| 20 | - $id = Str::slug($this->registration->key(). ($this->hasExistingModel() ? '-'. $this->existingModel()->id : ''));  | 
                                                        |
| 20 | + $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : ''));  | 
                                                        |
| 21 | 21 | $key = $this->registration->key();  | 
                                                        
| 22 | 22 | $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key);  | 
                                                        
| 23 | 23 | $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key);  | 
                                                        
@@ -23,7 +23,7 @@  | 
                                                    ||
| 23 | 23 | |
| 24 | 24 | public function scopeUnarchived($query)  | 
                                                        
| 25 | 25 |      { | 
                                                        
| 26 | - $query->withoutGlobalScope(ArchiveScope::class)->where(PageState::KEY,'<>', PageState::ARCHIVED);  | 
                                                        |
| 26 | + $query->withoutGlobalScope(ArchiveScope::class)->where(PageState::KEY, '<>', PageState::ARCHIVED);  | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | 29 | public function scopeWithArchived($query)  | 
                                                        
@@ -20,8 +20,8 @@ discard block  | 
                                                    ||
| 20 | 20 | $this->manager = $manager;  | 
                                                        
| 21 | 21 | $this->model = $manager->existingModel();  | 
                                                        
| 22 | 22 | |
| 23 | -        if(!$this->model instanceof StatefulContract){ | 
                                                        |
| 24 | - throw new \InvalidArgumentException(static::class . ' requires the model to implement the ' . StatefulContract::class);  | 
                                                        |
| 23 | +        if (!$this->model instanceof StatefulContract) { | 
                                                        |
| 24 | + throw new \InvalidArgumentException(static::class.' requires the model to implement the '.StatefulContract::class);  | 
                                                        |
| 25 | 25 | }  | 
                                                        
| 26 | 26 | }  | 
                                                        
| 27 | 27 | |
@@ -36,7 +36,7 @@ discard block  | 
                                                    ||
| 36 | 36 | |
| 37 | 37 | public function guard($verb): Assistant  | 
                                                        
| 38 | 38 |      { | 
                                                        
| 39 | -        if (! $this->can($verb)) { | 
                                                        |
| 39 | +        if (!$this->can($verb)) { | 
                                                        |
| 40 | 40 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager);  | 
                                                        
| 41 | 41 | }  | 
                                                        
| 42 | 42 | |
@@ -95,7 +95,7 @@ discard block  | 
                                                    ||
| 95 | 95 |      { | 
                                                        
| 96 | 96 | $transitions = [];  | 
                                                        
| 97 | 97 | |
| 98 | -        foreach($this->transitions as $transitionKey => $transition){ | 
                                                        |
| 98 | +        foreach ($this->transitions as $transitionKey => $transition) { | 
                                                        |
| 99 | 99 |              if (false !== array_search($this->statefulContract->stateOf($this->stateKey), $transition['from'])) { | 
                                                        
| 100 | 100 | $transitions[] = $transitionKey;  | 
                                                        
| 101 | 101 | }  | 
                                                        
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | private function validateTransitions()  | 
                                                        
| 108 | 108 |      { | 
                                                        
| 109 | 109 |          foreach ($this->transitions as $transitionKey => $transition) { | 
                                                        
| 110 | -            if (!array_key_exists('from', $transition) || !array_key_exists('to',$transition) || !is_array($transition['from'])) { | 
                                                        |
| 110 | +            if (!array_key_exists('from', $transition) || !array_key_exists('to', $transition) || !is_array($transition['from'])) { | 
                                                        |
| 111 | 111 | throw StateException::malformedTransition($transitionKey, $this);  | 
                                                        
| 112 | 112 | }  | 
                                                        
| 113 | 113 | |