|
@@ -49,7 +49,7 @@ discard block |
|
|
block discarded – undo |
|
49
|
49
|
) { |
|
50
|
50
|
$resultGroup[$model->modelReference()->getShort()] = [ |
|
51
|
51
|
'label' => $model->title, |
|
52
|
|
- 'url' => '/admin/' . $model->managedModelKey() . '/' . $model->id . '/edit', |
|
|
52
|
+ 'url' => '/admin/'.$model->managedModelKey().'/'.$model->id.'/edit', |
|
53
|
53
|
]; |
|
54
|
54
|
} |
|
55
|
55
|
} |
|
@@ -59,8 +59,8 @@ discard block |
|
|
block discarded – undo |
|
59
|
59
|
|
|
60
|
60
|
// Add model index page to result group |
|
61
|
61
|
array_push($resultGroup, [ |
|
62
|
|
- 'label' => ucfirst($modelGroup['label']) . ' overzicht', |
|
63
|
|
- 'url' => '/admin/' . $firstModel->managedModelKey(), |
|
|
62
|
+ 'label' => ucfirst($modelGroup['label']).' overzicht', |
|
|
63
|
+ 'url' => '/admin/'.$firstModel->managedModelKey(), |
|
64
|
64
|
]); |
|
65
|
65
|
|
|
66
|
66
|
// Add result group to search results |
|
@@ -78,20 +78,20 @@ discard block |
|
|
block discarded – undo |
|
78
|
78
|
{ |
|
79
|
79
|
// Can we generate this in a different way, or move these out of this method |
|
80
|
80
|
$adminPages = collect([ |
|
81
|
|
- [ 'label' => 'Dashboard', 'url' => route('chief.back.dashboard'), 'permission' => null, 'tags' => ['home'], ], |
|
82
|
|
- [ 'label' => 'Menu', 'url' => route('chief.back.menus.index'), 'permission' => 'update-page', 'tags' => ['navigatie'], ], |
|
83
|
|
- [ 'label' => 'Media', 'url' => route('chief.mediagallery.index'), 'permission' => 'update-page', 'tags' => ['mediagalerij', 'mediabibliotheek', 'assets'], ], |
|
84
|
|
- [ 'label' => 'Teksten', 'url' => route('squanto.index'), 'permission' => 'view-squanto', 'tags' => ['squanto', 'mediagalerij', 'mediabibliotheek', 'assets'], ], |
|
85
|
|
- [ 'label' => 'Sitemap', 'url' => route('chief.back.sitemap.show'), 'permission' => null, 'tags' => [], ], |
|
86
|
|
- [ 'label' => 'Admins', 'url' => route('chief.back.users.index'), 'permission' => 'view-user', 'tags' => [], ], |
|
87
|
|
- [ 'label' => 'Rechten', 'url' => route('chief.back.roles.index'), 'permission' => 'view-role', 'tags' => ['roles'], ], |
|
88
|
|
- [ 'label' => 'Settings', 'url' => route('chief.back.settings.edit'), 'permission' => 'update-setting', 'tags' => ['instellingen'], ], |
|
89
|
|
- [ 'label' => 'Audit', 'url' => route('chief.back.audit.index'), 'permission' => 'view-audit', 'tags' => [], ], |
|
90
|
|
- [ 'label' => chiefAdmin()->firstname, 'url' => route('chief.back.you.edit'), 'permission' => 'update-you', 'tags' => ['account'], ], |
|
91
|
|
- [ 'label' => 'Logout', 'url' => route('chief.back.logout'), 'permission' => null, 'tags' => [], ], |
|
|
81
|
+ ['label' => 'Dashboard', 'url' => route('chief.back.dashboard'), 'permission' => null, 'tags' => ['home'], ], |
|
|
82
|
+ ['label' => 'Menu', 'url' => route('chief.back.menus.index'), 'permission' => 'update-page', 'tags' => ['navigatie'], ], |
|
|
83
|
+ ['label' => 'Media', 'url' => route('chief.mediagallery.index'), 'permission' => 'update-page', 'tags' => ['mediagalerij', 'mediabibliotheek', 'assets'], ], |
|
|
84
|
+ ['label' => 'Teksten', 'url' => route('squanto.index'), 'permission' => 'view-squanto', 'tags' => ['squanto', 'mediagalerij', 'mediabibliotheek', 'assets'], ], |
|
|
85
|
+ ['label' => 'Sitemap', 'url' => route('chief.back.sitemap.show'), 'permission' => null, 'tags' => [], ], |
|
|
86
|
+ ['label' => 'Admins', 'url' => route('chief.back.users.index'), 'permission' => 'view-user', 'tags' => [], ], |
|
|
87
|
+ ['label' => 'Rechten', 'url' => route('chief.back.roles.index'), 'permission' => 'view-role', 'tags' => ['roles'], ], |
|
|
88
|
+ ['label' => 'Settings', 'url' => route('chief.back.settings.edit'), 'permission' => 'update-setting', 'tags' => ['instellingen'], ], |
|
|
89
|
+ ['label' => 'Audit', 'url' => route('chief.back.audit.index'), 'permission' => 'view-audit', 'tags' => [], ], |
|
|
90
|
+ ['label' => chiefAdmin()->firstname, 'url' => route('chief.back.you.edit'), 'permission' => 'update-you', 'tags' => ['account'], ], |
|
|
91
|
+ ['label' => 'Logout', 'url' => route('chief.back.logout'), 'permission' => null, 'tags' => [], ], |
|
92
|
92
|
]); |
|
93
|
93
|
|
|
94
|
|
- $results = $adminPages->filter(function ($adminPage) use ($term) { |
|
|
94
|
+ $results = $adminPages->filter(function($adminPage) use ($term) { |
|
95
|
95
|
// TODO: check if current user has necessary permissions to view page |
|
96
|
96
|
// if(! chiefAdmin()->hasPermissionTo($adminPage['permission'])) { |
|
97
|
97
|
// return false; |
|
@@ -103,14 +103,14 @@ discard block |
|
|
block discarded – undo |
|
103
|
103
|
} |
|
104
|
104
|
|
|
105
|
105
|
// Check if any of tags contain search term |
|
106
|
|
- if (collect($adminPage['tags'])->contains(function ($tag) use ($term) { |
|
|
106
|
+ if (collect($adminPage['tags'])->contains(function($tag) use ($term) { |
|
107
|
107
|
return Str::contains(Str::lower($tag), $term); |
|
108
|
108
|
})) { |
|
109
|
109
|
return true; |
|
110
|
110
|
}; |
|
111
|
111
|
|
|
112
|
112
|
return false; |
|
113
|
|
- })->map(function ($adminPage) { |
|
|
113
|
+ })->map(function($adminPage) { |
|
114
|
114
|
return [ |
|
115
|
115
|
'label' => $adminPage['label'], |
|
116
|
116
|
'url' => $adminPage['url'], |
|
@@ -133,10 +133,10 @@ discard block |
|
|
block discarded – undo |
|
133
|
133
|
{ |
|
134
|
134
|
return collect(app(Registry::class)->models()) |
|
135
|
135
|
// Filter out fragment models |
|
136
|
|
- ->filter(function ($model) { |
|
137
|
|
- return ! in_array('Thinktomorrow\Chief\Fragments\Fragmentable', class_implements($model)); |
|
|
136
|
+ ->filter(function($model) { |
|
|
137
|
+ return !in_array('Thinktomorrow\Chief\Fragments\Fragmentable', class_implements($model)); |
|
138
|
138
|
// Return all instances of the models |
|
139
|
|
- })->map(function ($model) { |
|
|
139
|
+ })->map(function($model) { |
|
140
|
140
|
$models = $model::all(); |
|
141
|
141
|
|
|
142
|
142
|
return [ |