update display name
This commit is contained in:
parent
37c2ebe886
commit
e8090bbe01
@ -946,7 +946,7 @@ class Version200 extends Listener
|
|||||||
|
|
||||||
public function updatePermissionNames($items)
|
public function updatePermissionNames($items)
|
||||||
{
|
{
|
||||||
$prefixes = [
|
$actions = [
|
||||||
'create',
|
'create',
|
||||||
'read',
|
'read',
|
||||||
'update',
|
'update',
|
||||||
@ -954,14 +954,16 @@ class Version200 extends Listener
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($items as $old => $new) {
|
foreach ($items as $old => $new) {
|
||||||
foreach ($prefixes as $prefix) {
|
foreach ($actions as $action) {
|
||||||
$old_name = $prefix . '-' . $old;
|
$old_name = $action . '-' . $old;
|
||||||
$new_name = $prefix . '-' . $new;
|
$new_name = $action . '-' . $new;
|
||||||
|
$new_display_name = Str::title(str_replace('-', ' ', $new_name));
|
||||||
|
|
||||||
DB::table('permissions')
|
DB::table('permissions')
|
||||||
->where('name', $old_name)
|
->where('name', $old_name)
|
||||||
->update([
|
->update([
|
||||||
'name' => $new_name,
|
'name' => $new_name,
|
||||||
|
'display_name' => $new_display_name,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user