mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-12 17:11:08 +03:30
fix
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Modules\Permission\App\Helper\AccessMain;
|
||||
use Modules\Permission\App\Helper\PermissionMain;
|
||||
use Modules\Permission\App\Helper\RoleMain;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
// assign all permissions to role administrator
|
||||
$permissionMain = New AccessMain();
|
||||
if($permissionMain->assignAllRoleToAdministrator()){
|
||||
dump('Success: Created Role Administrator');
|
||||
|
||||
// create roles default - admin
|
||||
$roleMain = new RoleMain();
|
||||
if($roleMain->getItems()->where('name', 'admin')->first() == null){
|
||||
if(!$roleMain->storeToDB(['name' => 'admin'])){
|
||||
dump('Error: Can Not Create Role Admin');
|
||||
}else{
|
||||
dump('Success: Created Role Admin');
|
||||
}
|
||||
}
|
||||
|
||||
// create roles default - user
|
||||
$roleMain = new RoleMain();
|
||||
if($roleMain->getItems()->where('name','user')->first() == null){
|
||||
if(!$roleMain->storeToDB(['name' => 'user'])){
|
||||
dump('Error: Can Not Create Role User');
|
||||
}else{
|
||||
dump('Success: Created Role User');
|
||||
}
|
||||
}
|
||||
|
||||
// create roles default - caller
|
||||
$roleMain = new RoleMain();
|
||||
if($roleMain->getItems()->where('name','caller')->first() == null){
|
||||
if(!$roleMain->storeToDB(['name' => 'caller'])){
|
||||
dump('Error: Can Not Create Role Caller');
|
||||
}else{
|
||||
dump('Success: Created Role Caller');
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
dump('Error: Please Check And Run Again.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user