%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/ccd-ind-code/database/seeders/
Upload File :
Create Path :
Current File : /home/silvzytp/ccd-ind-code/database/seeders/PermissionSeeder.php

<?php

namespace Database\Seeders;

use App\Models\Module;
use App\Models\Permission;
use Illuminate\Database\Seeder;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Dashboard
        $moduleAppDashboard = Module::updateOrCreate(['name' => 'Dashboard Management']);
        Permission::updateOrCreate([
            'module_id' => $moduleAppDashboard->id,
            'name' => 'Access Dashboard',
            'slug' => 'app.dashboard',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleAppDashboard->id,
            'name' => 'Dashboard Filter (Manager Panel)',
            'slug' => 'app.dashboard.filter',
        ]);

        // Profile
        $moduleAppProfile = Module::updateOrCreate(['name' => 'Profile']);
        Permission::updateOrCreate([
            'module_id' => $moduleAppProfile->id,
            'name' => 'Access Profile',
            'slug' => 'app.profile.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleAppProfile->id,
            'name' => 'Update Profile',
            'slug' => 'app.profile.update',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleAppProfile->id,
            'name' => 'Access Password',
            'slug' => 'app.password.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleAppProfile->id,
            'name' => 'Update Password',
            'slug' => 'app.password.update',
        ]);

        // Admin management
        $moduleAdmin = Module::updateOrCreate(['name' => 'Admin Management']);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Access Admin',
            'slug' => 'app.admins.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Create Admin',
            'slug' => 'app.admins.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'View Admin',
            'slug' => 'app.admins.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Edit Admin',
            'slug' => 'app.admins.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Delete Admin',
            'slug' => 'app.admins.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Bulk Delete Admin',
            'slug' => 'app.admins.bulk-destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Bulk Enabled/Disabled',
            'slug' => 'app.admins.bulk-status',
        ]);


        // Manager management
        $moduleManager = Module::updateOrCreate(['name' => 'Manager Management']);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Access Manager',
            'slug' => 'app.managers.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Create Manager',
            'slug' => 'app.managers.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Manager Edit',
            'slug' => 'app.managers.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'View Manager',
            'slug' => 'app.managers.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Delete Manager',
            'slug' => 'app.managers.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Bulk Delete Manager',
            'slug' => 'app.managers.bulk-destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Bulk Enabled/Disabled',
            'slug' => 'app.managers.bulk-status',
        ]);

        // Agent management
        $moduleAppUser = Module::updateOrCreate(['name' => 'Agent Management']);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Access Agent',
            'slug' => 'app.agents.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Create Agent',
            'slug' => 'app.agents.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Agent Edit',
            'slug' => 'app.agents.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'View Agent',
            'slug' => 'app.agents.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Delete Agent',
            'slug' => 'app.agents.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Bulk Delete Agent',
            'slug' => 'app.agents.bulk-destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Agent Assign',
            'slug' => 'app.agents.assign',
        ]);

        // Calling management
        $colling = Module::updateOrCreate(['name' => 'Calling Management']);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Access Calling',
            'slug' => 'app.callings.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Create Calling',
            'slug' => 'app.callings.create',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Edit Calling',
            'slug' => 'app.callings.edit',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Delete Calling',
            'slug' => 'app.callings.delete',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Assign Agent',
            'slug' => 'app.callings.assign',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'View Calling',
            'slug' => 'app.callings.show',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Reject Calling',
            'slug' => 'app.callings.reject',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Calling Transfer',
            'slug' => 'app.callings.transfer',
        ]);

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Compare',
            'slug' => 'app.compare.index',
        ]);

        // Status management
        $status = Module::updateOrCreate(['name' => 'Status Management']);
        Permission::updateOrCreate([
            'module_id' => $status->id,
            'name' => 'Access Status',
            'slug' => 'app.status.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $status->id,
            'name' => 'Create Status',
            'slug' => 'app.status.create',
        ]);

        Permission::updateOrCreate([
            'module_id' => $status->id,
            'name' => 'Edit Status',
            'slug' => 'app.status.edit',
        ]);

        Permission::updateOrCreate([
            'module_id' => $status->id,
            'name' => 'Delete Status',
            'slug' => 'app.status.delete',
        ]);

        // Sub Status management
        $subStatus = Module::updateOrCreate(['name' => 'Sub Status Management']);
        Permission::updateOrCreate([
            'module_id' => $subStatus->id,
            'name' => 'Access Sub Status',
            'slug' => 'app.sub-status.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $subStatus->id,
            'name' => 'Create Sub Status',
            'slug' => 'app.sub-status.create',
        ]);

        Permission::updateOrCreate([
            'module_id' => $subStatus->id,
            'name' => 'Edit Sub Status',
            'slug' => 'app.sub-status.edit',
        ]);

        Permission::updateOrCreate([
            'module_id' => $subStatus->id,
            'name' => 'Delete Sub Status',
            'slug' => 'app.sub-status.delete',
        ]);

    }
}

Zerion Mini Shell 1.0