<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;


class UsersTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if(DB::table('users')->get()->count() == 0){
            DB::table('users')->insert([
                'firstName' => 'Babu O.',
                'lastName' => 'Katula',
                'phone' => '0719628412',
                'email' => 'support@mycloudims.net',
                'password' => bcrypt('Pravastica@123'),
                'sign_dir' => 'signs/1.png',
                'branch' => '1',
                'access' => '0',
                'session_no' => '',
                'admin' => '1',
                'dash' => '1',
                'endowment' => '1',
                'reports' => '1',
                'quotation' => '1',
                'finance' => '1',
                'settings' => '1',
                'created_by' => '1',
                'stamp' => strtoupper(Str::random(5)),
                'created_at' => now(),
                'updated_at' => now()
            ]);
        }else
        {
            echo "Users Table is not empty.";
        }
    }
}
