app/Console/Commands/CreateAdmin.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $email = $this->argument('email');
        $password = $this->argument('password');
        $result = \DB::table('users')->insert([
            'name' =>  $email ,
            'firstName' => 'Admin-'.date('YmdHis'),
            'cardID' => mt_rand(0000000000000, 9999999999999),
            'phone' => '0909359085',
            'code' => date('YmdHis'),
            'email' => $email,
            'password' => bcrypt($password),
            'created_at' => date('Y-m-d H:i:s'),
            'role' => 99,
            'isAdmin' =>1
        ]);
        if($result)  $this->info('Create success.');
    }
public function handle ( ) { $ email = $ this -> argument ( 'email' ) ; $ password = $ this -> argument ( 'password' ) ; $ result = \ DB :: table ( 'users' ) -> insert ( [ 'name' => $ email , 'firstName' => 'Admin-' . date ( 'YmdHis' ) , 'cardID' => mt_rand ( 0000000000000 , 9999999999999 ) , 'phone' => '0909359085' , 'code' => date ( 'YmdHis' ) , 'email' => $ email , 'password' => bcrypt ( $ password ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'role' => 99 , 'isAdmin' => 1 ] ) ; if ( $ result ) $ this -> info ( 'Create success.' ) ; }
Execute the console command.
Execute the console command .
//