database/seeders/PermissionRoleSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $admin_permissions = Permission::all();
        Role::findOrFail(1)->permission()->sync($admin_permissions->pluck('id'));
        $user_permissions = $admin_permissions->filter(function ($permission) {
            return substr($permission->title, 0, 5) != 'user_' && substr($permission->title, 0, 5) != 'role_' && substr($permission->title, 0, 11) != 'permission_';
        });
        Role::findOrFail(2)->permission()->sync($user_permissions);
    }
public function run ( ) { $ admin_permissions = Permission :: all ( ) ; Role :: findOrFail ( 1 ) -> permission ( ) -> sync ( $ admin_permissions -> pluck ( 'id' ) ) ; $ user_permissions = $ admin_permissions -> filter ( function ( $ permission ) { return substr ( $ permission -> title , 0 , 5 ) != 'user_' && substr ( $ permission -> title , 0 , 5 ) != 'role_' && substr ( $ permission -> title , 0 , 11 ) != 'permission_' ; } ) ; Role :: findOrFail ( 2 ) -> permission ( ) -> sync ( $ user_permissions ) ; }
Run the database seeds.
Run the database seeds .
// for super admin // get permission simple for admin // for admin