%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/crm-ind-code/database/seeders/
Upload File :
Create Path :
Current File : /home/silvzytp/crm-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']);
        Permission::updateOrCreate([
            'module_id' => $moduleAppDashboard->id,
            'name' => 'Access',
            'slug' => 'app.dashboard',
        ]);

        Permission::updateOrCreate([
            'module_id' => $moduleAppDashboard->id,
            'name' => 'Filter',
            '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']);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Access',
            'slug' => 'app.admins.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Create',
            'slug' => 'app.admins.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'View',
            'slug' => 'app.admins.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Edit',
            'slug' => 'app.admins.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Delete',
            'slug' => 'app.admins.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAdmin->id,
            'name' => 'Bulk Delete',
            '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']);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Access',
            'slug' => 'app.managers.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Create',
            'slug' => 'app.managers.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Edit',
            'slug' => 'app.managers.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'View',
            'slug' => 'app.managers.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Delete',
            'slug' => 'app.managers.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleManager->id,
            'name' => 'Bulk Delete',
            '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']);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Access',
            'slug' => 'app.agents.index',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Create',
            'slug' => 'app.agents.create',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Edit',
            'slug' => 'app.agents.edit',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'View',
            'slug' => 'app.agents.show',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Delete',
            'slug' => 'app.agents.destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Bulk Delete',
            'slug' => 'app.agents.bulk-destroy',
        ]);
        Permission::updateOrCreate([
            'module_id' => $moduleAppUser->id,
            'name' => 'Assign',
            'slug' => 'app.agents.assign',
        ]);

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

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

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

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

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

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

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Export Call Data',
            'slug' => 'app.calling.export',
        ]);

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

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

        Permission::updateOrCreate([
            'module_id' => $colling->id,
            'name' => 'Recycle Lead Pool',
            'slug' => 'app.recycle.pool',
        ]);

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

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

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

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

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

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

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

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


        // Fresh campaign permission
        $campaign = Module::updateOrCreate(['name' => 'Campaign']);
        Permission::updateOrCreate([
            'module_id' => $campaign->id,
            'name' => 'Access',
            'slug' => 'app.campaign.index',
        ]);

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

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

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

        // Fresh campaign permission
        $lead_type = Module::updateOrCreate(['name' => 'Lead Type']);
        Permission::updateOrCreate([
            'module_id' => $lead_type->id,
            'name' => 'Access',
            'slug' => 'app.lead-type.index',
        ]);

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

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

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

        // Fresh lead permission
        $fresh = Module::updateOrCreate(['name' => 'Fresh Lead']);
        Permission::updateOrCreate([
            'module_id' => $fresh->id,
            'name' => 'Access',
            'slug' => 'app.fresh-lead.index',
        ]);

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

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

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

        Permission::updateOrCreate([
            'module_id' => $fresh->id,
            'name' => 'Bulk Operation',
            'slug' => 'app.fresh-lead.bulk-operation',
        ]);

        Permission::updateOrCreate([
            'module_id' => $fresh->id,
            'name' => 'Lead Pool',
            'slug' => 'app.fresh-lead.pool',
        ]);

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

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

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

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

        // Category permission
        $channel = Module::updateOrCreate(['name' => 'Channel']);
        Permission::updateOrCreate([
            'module_id' => $channel->id,
            'name' => 'Access',
            'slug' => 'app.channel.index',
        ]);

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

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

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


        // Category permission
        $marketingSource = Module::updateOrCreate(['name' => 'Marketing Source']);
        Permission::updateOrCreate([
            'module_id' => $marketingSource->id,
            'name' => 'Access',
            'slug' => 'app.marketing-source.index',
        ]);

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

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

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

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

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

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

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

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

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

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

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


        // Sub-Location permission
        $subLocation = Module::updateOrCreate(['name' => 'Sub-Location']);
        Permission::updateOrCreate([
            'module_id' => $subLocation->id,
            'name' => 'Access',
            'slug' => 'app.sub-location.index',
        ]);

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

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

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


    }
}

Zerion Mini Shell 1.0