rbrecruiter/database/seeds/NewPermissions.php

32 lines
716 B
PHP
Raw Permalink Normal View History

2020-08-30 22:06:01 +00:00
<?php
use Illuminate\Database\Seeder;
2020-08-31 15:41:01 +00:00
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
2020-08-30 22:06:01 +00:00
class NewPermissions extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
2020-08-31 15:41:01 +00:00
$developer = Role::create([
'name' => 'developer'
2020-08-30 22:06:01 +00:00
]);
2020-08-31 16:55:36 +00:00
$admin = Role::where('name', 'admin')->first();
2020-08-30 22:06:01 +00:00
Permission::create(['name' => 'admin.settings.view']);
Permission::create(['name' => 'admin.settings.edit']);
$developer->givePermissionTo('admin.developertools.use');
2020-08-31 16:55:36 +00:00
$admin->givePermissionTo('admin.settings.view');
$admin->givePermissionTo('admin.settings.edit');
2020-08-30 22:06:01 +00:00
}
}