<?php

namespace Modules\Dummy\Database\Seeders\Core\Versions\V3_1_1;

use App\Models\Permission;
use App\Models\PermissionRole;
use Illuminate\Database\Seeder;

class PermissionsTableSeeder extends Seeder
{
    public function run()
    {
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@create')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@index',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'index',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@create')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@create',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'create',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@store')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@store',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'store',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@edit')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@edit',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'edit',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@update')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@update',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'update',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@destroy')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@destroy',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'destroy',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@suggestion')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@suggestion',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'suggestion',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@assignBrand')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController@assignBrand',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\BrandController',
                'controller_name' => 'BrandController',
                'method_name' => 'assignBrand',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@create')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@index',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'index',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@create')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@create',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'create',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@store')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@store',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'store',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@edit')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@edit',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'edit',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@update')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@update',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'update',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@destroy')->first()) {

            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController@destroy',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Catalog\\AttributeController',
                'controller_name' => 'AttributeController',
                'method_name' => 'destroy',
            ]);
            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
    }
}
