database/seeds/RoleSeed.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $role = Role::create(['name' => 'admin']);
        $permissions = array();
        foreach(Permission::all()->pluck('name') as $permission){
            $permissions[] = $permission;
        }
        $role->givePermissionTo($permissions);
    }
public function run ( ) { $ role = Role :: create ( [ 'name' => 'admin' ] ) ; $ permissions = array ( ) ; foreach ( Permission :: all ( ) -> pluck ( 'name' ) as $ permission ) { $ permissions [ ] = $ permission ; } $ role -> givePermissionTo ( $ permissions ) ; }
Run the database seeds.
Run the database seeds .