Today I call command
through controler
perfectly, but I'd like to send variables too. In controller
, I call command
like this:
\Artisan::call('syncustomer:sav');
The name attribute of the current command:
protected $name = 'syncustomer:sav';
In the documentation I saw that I could pass the variables as follows:
\Artisan::call('syncustomer:sav', ['[email protected]']);
So, the name
of command
would look like this:
protected $name = 'syncustomer:sav {data}';
The controller
does not show error, but when I try to get this variable in handle()
it gives error saying that there is no argument data
:
public function handle(){
$email = $this->argument('data');
DB::table('customer')
->where('email', '[email protected]')
->update(array('email' => $email));
}
The data argument does not exist
.
Can anyone help me?