欢迎各位兄弟 发布技术文章
这里的技术是共享的
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
class UpdatePassword extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'uppwd {nameemailpwd*}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'this is update user email passord ';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//
$arguments = $this->argument('nameemailpwd');
if(count($arguments)<3){
$this->error($arguments[0].' '.$arguments[1].' '.$arguments[2]. ' need three arguments, update name email password failed');
}
DB::table('users')->where('id',1)->update(array('name'=>$arguments[0],'email'=>$arguments[1],'password'=>bcrypt($arguments[2])));
$this->info('update name email password success');
}
}