<?php

use Illuminate\Database\Seeder;

use App\User;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;





class UserSeeds extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    
    public function run()
    {
        app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();

        // $user = User::create([
        //     'branch_id' => 1,

        //     'name' => "Gis Plus",
        //     'email' => "info@gisplus.net",
        //     'password' => Hash::make("gisplus"),
        //     'cnic' => ("12345-0202020-7"),
        //     'designation' => "Administrator",
        //     'type'=>'Administrator',
        //     'status'=>'Active',
        //     'created_at' => now(),
        //     'updated_at' => now(),
        // ]);

        // $role = Role::create(['name' => 'User']);

         $permission = Permission::create(['name' => 'All']);
         

        //  $role->givePermissionTo($permission);
        //  $permission->assignRole($role);

        //  $user->assignRole('User');
        //  $user->givePermissionTo('All');


       

         $user1 = User::create([
            'branch_id' => 1,
            'name' => "Estatech",
            'email' => "estatech@gisplus.net",
            'password' => Hash::make("gisplus"),
            'cnic' => ("10345-0202020-7"),
            'designation_id' => 1,
            'type'=>'Super Admin',
            'status'=>'Active',
            'created_at' => now(),
            'updated_at' => now(),
        ]);

        

         // $user1->assignRole('User');
         $user1->givePermissionTo('All');


    }
}
