turtle-wow-source-kinda/Dumps/Source Code/8 - Development_website/develop/database/seeders/PermissionRoleTableSeeder.php

27 lines
495 B
PHP
Raw Normal View History

2024-08-06 16:06:40 +00:00
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use TCG\Voyager\Models\Permission;
use TCG\Voyager\Models\Role;
class PermissionRoleTableSeeder extends Seeder
{
/**
* Auto generated seed file.
*
* @return void
*/
public function run()
{
$role = Role::where('name', 'admin')->firstOrFail();
$permissions = Permission::all();
$role->permissions()->sync(
$permissions->pluck('id')->all()
);
}
}