@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | DB::beginTransaction(); |
22 | 22 | |
23 | 23 | // For stateful transitions we will apply this deletion as a state |
24 | - if($model instanceof StatefulContract) { |
|
24 | + if ($model instanceof StatefulContract) { |
|
25 | 25 | (new PageState($model))->apply('delete'); |
26 | 26 | $model->save(); |
27 | 27 | } |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | Relation::deleteRelationsOf($model->getMorphClass(), $model->id); |
30 | 30 | |
31 | 31 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
32 | - if($model instanceof Module) { |
|
32 | + if ($model instanceof Module) { |
|
33 | 33 | $model->update([ |
34 | - 'slug' => $model->slug . $this->appendDeleteMarker(), |
|
34 | + 'slug' => $model->slug.$this->appendDeleteMarker(), |
|
35 | 35 | ]); |
36 | 36 | } |
37 | 37 | |
38 | - if($model instanceof ProvidesUrl){ |
|
38 | + if ($model instanceof ProvidesUrl) { |
|
39 | 39 | UrlRecord::getByModel($model)->each->delete(); |
40 | 40 | } |
41 | 41 | |
42 | - if($model instanceof Page){ |
|
42 | + if ($model instanceof Page) { |
|
43 | 43 | Module::where('page_id', $model->id)->delete(); |
44 | 44 | } |
45 | 45 | |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | |
59 | 59 | private function appendDeleteMarker(): string |
60 | 60 | { |
61 | - return '_DELETED_' . time(); |
|
61 | + return '_DELETED_'.time(); |
|
62 | 62 | } |
63 | 63 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $registrations = collect($this->register->filterByTag($tag)->all()); |
52 | 52 | |
53 | - return $registrations->map(function ($registration) { |
|
53 | + return $registrations->map(function($registration) { |
|
54 | 54 | return $this->instance($registration); |
55 | 55 | }); |
56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | $registrations = collect($this->register->filterByTag($tag)->all()); |
67 | 67 | |
68 | - return $registrations->map(function ($registration) { |
|
68 | + return $registrations->map(function($registration) { |
|
69 | 69 | return $this->instance($registration)->details(); |
70 | 70 | }); |
71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | //return array with group name and values |
77 | 77 | $grouped = []; |
78 | 78 | |
79 | - $managers = $managers->map(function (Manager $item) { |
|
79 | + $managers = $managers->map(function(Manager $item) { |
|
80 | 80 | return [ |
81 | 81 | 'id' => $item->details()->id, |
82 | 82 | 'group' => $item->details()->plural, |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $registrations = collect($this->register->all()); |
92 | 92 | |
93 | - return $registrations->map(function ($registration) { |
|
93 | + return $registrations->map(function($registration) { |
|
94 | 94 | return $this->instance($registration); |
95 | 95 | }); |
96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $assistants = collect(); |
101 | 101 | |
102 | - foreach($this->all() as $manager) { |
|
102 | + foreach ($this->all() as $manager) { |
|
103 | 103 | $assistants = $assistants->merge($manager->assistants(false)); |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | public function anyRegisteredByTag($tag) |
110 | 110 | { |
111 | - return ! empty($this->register->filterByTag($tag)->all()); |
|
111 | + return !empty($this->register->filterByTag($tag)->all()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -13,10 +13,10 @@ |
||
13 | 13 | |
14 | 14 | public static function register($app) |
15 | 15 | { |
16 | - Route::get('testje', [static::class, 'archive']); |
|
17 | - Route::get('testje', [AssistantController, 'archive']); |
|
16 | + Route::get('testje', [static::class, 'archive']); |
|
17 | + Route::get('testje', [AssistantController, 'archive']); |
|
18 | 18 | |
19 | - // fetched manager |
|
19 | + // fetched manager |
|
20 | 20 | // propagate naar assistant::archive |
21 | 21 | } |
22 | 22 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | public function assistant(string $assistantKey): Assistant |
52 | 52 | { |
53 | 53 | if (!$this->isAssistedBy($assistantKey)) { |
54 | - throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . static::class); |
|
54 | + throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.static::class); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $instance = app($this->getAssistantClass($assistantKey)); |
@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function findAllArchived(): Collection |
52 | 52 | { |
53 | - return $this->manager->modelInstance()::archived()->get()->map(function ($model) { |
|
53 | + return $this->manager->modelInstance()::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 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | app(PublishManagedModel::class)->handle($this->manager->existingModel()); |
57 | 57 | |
58 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title .' is online gezet.'); |
|
58 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is online gezet.'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function unpublish() |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | |
65 | 65 | app(UnpublishManagedModel::class)->handle($this->manager->existingModel()); |
66 | 66 | |
67 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title .' is offline gehaald.'); |
|
67 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is offline gehaald.'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function findAll(): Collection |
71 | 71 | { |
72 | - return $this->manager->existingModel()->published()->get()->map(function ($model) { |
|
72 | + return $this->manager->existingModel()->published()->get()->map(function($model) { |
|
73 | 73 | return $this->managers->findByModel($model); |
74 | 74 | }); |
75 | 75 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | private function guard($verb): Assistant |
93 | 93 | { |
94 | - if (! $this->can($verb)) { |
|
94 | + if (!$this->can($verb)) { |
|
95 | 95 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
96 | 96 | } |
97 | 97 | |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | $class = 'text-warning'; |
117 | 117 | } |
118 | 118 | |
119 | - $statusAsLabel = '<span class="font-bold '. $class .'"><em>' . $label . '</em></span>'; |
|
119 | + $statusAsLabel = '<span class="font-bold '.$class.'"><em>'.$label.'</em></span>'; |
|
120 | 120 | |
121 | 121 | if (!$plain && $this->hasPreviewUrl()) { |
122 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>'; |
|
122 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $statusAsLabel; |