Update Permission Seeder
This commit is contained in:
parent
480c12d6f7
commit
f05fd25e18
@ -17,7 +17,7 @@
|
|||||||
$data = $this->data();
|
$data = $this->data();
|
||||||
|
|
||||||
foreach ($data as $value) {
|
foreach ($data as $value) {
|
||||||
PermissionGroup::create([
|
PermissionGroup::updateOrCreate([
|
||||||
'name' => $value['name'],
|
'name' => $value['name'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,10 @@
|
|||||||
$data = $this->data();
|
$data = $this->data();
|
||||||
|
|
||||||
foreach ($data as $value) {
|
foreach ($data as $value) {
|
||||||
$permission = Permission::create([
|
$permission = Permission::updateOrCreate([
|
||||||
'name' => $value['name'],
|
'name' => $value['name'],
|
||||||
'guard_name' => 'web', // or 'api
|
'guard_name' => 'web' // or 'api
|
||||||
|
], [
|
||||||
'permission_group_id' => $value['group']
|
'permission_group_id' => $value['group']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -61,7 +62,7 @@
|
|||||||
{
|
{
|
||||||
$actions = [];
|
$actions = [];
|
||||||
// list of permission actions
|
// list of permission actions
|
||||||
$crud = ['create', 'read', 'update', 'delete', 'authorize', 'report'];
|
$crud = ['create', 'read', 'update', 'delete'];
|
||||||
|
|
||||||
foreach ($crud as $value) {
|
foreach ($crud as $value) {
|
||||||
$actions[] = $name . '.' . $value;
|
$actions[] = $name . '.' . $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user