32 lines
656 B
PHP
32 lines
656 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Permission;
|
|
use App\Models\Role;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class RoleSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$items = [
|
|
['name' => 'Administrator'],
|
|
['name' => 'Elev'],
|
|
['name' => 'Underviser'],
|
|
['name' => 'Helpdesk'],
|
|
['name' => 'Server'],
|
|
];
|
|
foreach ($items as $item) {
|
|
Role::create($item);
|
|
}
|
|
|
|
Role::where('name', '=', 'Administrator')->first()->permissions()->sync(Permission::all());
|
|
}
|
|
}
|