'admindoni', 'email' => 'admindoni@mail.com', 'password' => Hash::make('123456') ]); $role = Role::create(['name' => 'Super Admin']); $permissions = Permission::pluck('id', 'id')->all(); $role->syncPermissions($permissions); $user->assignRole([$role->id]); $permission = [ 'role-create', 'role-delete', 'role-update', 'role-list', 'permission-create', 'permission-delete', 'permission-update', 'permission-list', 'user-create', 'user-delete', 'user-update', 'user-list', ]; foreach ($permission as $key => $value) { $create_permission = Permission::create(['name' => $value]); DB::insert('insert into role_has_permissions (permission_id, role_id) values (?, ?)', [$create_permission->id, $role->id]); } DB::commit(); } }