2020-08-30 22:06:01 +00:00
|
|
|
<?php
|
2021-10-12 17:08:15 +00:00
|
|
|
namespace Database\Seeders;
|
2020-08-30 22:06:01 +00:00
|
|
|
|
|
|
|
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([
|
2021-10-13 00:47:16 +00:00
|
|
|
'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');
|
2021-10-13 00:47:16 +00:00
|
|
|
|
|
|
|
|
2020-08-30 22:06:01 +00:00
|
|
|
}
|
|
|
|
}
|