%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/crm-dub-code/database/seeders/
Upload File :
Create Path :
Current File : /home/silvzytp/crm-dub-code/database/seeders/UserSeeder.php

<?php

namespace Database\Seeders;

use App\Models\Role;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $superRole = Role::where('slug','super-admin')->first();
        // Create super-admin
        User::updateOrCreate([
            'role_id'  => $superRole->id,
            'name'     => 'Super Admin',
            'email'    => 'super@gmail.com',
            'password' => Hash::make(12345678),
            'password_text' => 12345678
        ]);

        $adminRole = Role::where('slug','admin')->first();
        // Create admin
        User::updateOrCreate([
            'role_id'       => $adminRole->id,
            'name'          => 'Admin',
            'email'         => 'admin@gmail.com',
            'password'      => Hash::make(12345678),
            'password_text' => 12345678,
        ]);

        // Create manager
        $managerRole = Role::where('slug','manager')->first();
        $manager = User::updateOrCreate([
            'role_id'       => $managerRole->id,
            'name'          => 'Manager',
            'email'         => 'manager@gmail.com',
            'password'      => Hash::make(12345678),
            'password_text' => 12345678,
        ]);

        // Create agent
        $agentRole = Role::where('slug','agent')->first();
        User::updateOrCreate([
            'role_id'       => $agentRole->id,
            'manager_id'    => $manager->id,
            'name'          => 'Agent',
            'email'         => 'agent@gmail.com',
            'password'      => Hash::make(12345678),
            'password_text' => 12345678,
        ]);

        // Create agent
        $agentRole = Role::where('slug','agent')->first();
        User::updateOrCreate([
            'role_id'       => $agentRole->id,
            'manager_id'    => $manager->id,
            'name'          => 'New Agent',
            'email'         => 'nagent@gmail.com',
            'password'      => Hash::make(12345678),
            'password_text' => 12345678,
        ]);
    }
}

Zerion Mini Shell 1.0