vmailadmin/database/seeds/ConnectRelationshipsSeeder.php
2020-05-23 15:20:01 +02:00

28 lines
597 B
PHP

<?php
use Illuminate\Database\Seeder;
class ConnectRelationshipsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
/**
* Get Available Permissions.
*/
$permissions = config('roles.models.permission')::all();
/**
* Attach Permissions to Roles.
*/
$roleAdmin = config('roles.models.role')::where('name', '=', 'Admin')->first();
foreach ($permissions as $permission) {
$roleAdmin->attachPermission($permission);
}
}
}