%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/dsr_code/database/seeders/
Upload File :
Create Path :
Current File : /home/silvzytp/dsr_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',
        ]);

        // Monthly Commitment management
        $moduleMonthlyCommit = Module::updateOrCreate(['name' => 'Monthly Commitment']);
        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyCommit->id,
            'name' => 'Access Monthly Commitment',
            'slug' => 'app.monthly.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyCommit->id,
            'name' => 'Create Monthly Commitment',
            'slug' => 'app.monthly.create',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyCommit->id,
            'name' => 'Edit Monthly Commitment',
            'slug' => 'app.monthly.edit',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyCommit->id,
            'name' => 'Delete Monthly Commitment',
            'slug' => 'app.monthly.destroy',
        ]);

        // Monthly Data management
        $moduleMonthlyData = Module::updateOrCreate(['name' => 'Monthly Data']);
        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyData->id,
            'name' => 'Access Monthly Data',
            'slug' => 'app.monthly-data.index',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyData->id,
            'name' => 'Create Monthly Data',
            'slug' => 'app.monthly-data.create',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyData->id,
            'name' => 'Edit Monthly Data',
            'slug' => 'app.monthly-data.edit',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleMonthlyData->id,
            'name' => 'Delete Monthly Data',
            'slug' => 'app.monthly-data.destroy',
        ]);

        // Manager Compare management
        $moduleCompare = Module::updateOrCreate(['name' => 'Manager Compare']);
        Permission::updateOrCreate([
            'module_id' => $moduleCompare->id,
            'name' => 'Access Compare <small class="text-danger">(without manager)</small>',
            'slug' => 'app.compare.index',
        ]);

        // Manager Target management
        $moduleCompare = Module::updateOrCreate(['name' => 'Manager Individual Target']);
        Permission::updateOrCreate([
            'module_id' => $moduleCompare->id,
            'name' => 'Access Target',
            'slug' => 'app.target.index',
        ]);

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

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

        Permission::updateOrCreate([
            'module_id' => $moduleCompare->id,
            'name' => 'Delete Target',
            'slug' => 'app.target.destroy',
        ]);

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


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

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

    }
}

Zerion Mini Shell 1.0