Reputation: 9009
I've generate Laravel artisan command by php artisan make:command SomeCommand
. Here is the entire command class SomeCommand
.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SomeCommand extends Command{
protected $signature = 'Call:SomeCommand {phone="8980131488"} {name="Kiran Maniya"}';
protected $description = 'This is a buggy Command';
public function __construct(){
parent::__construct();
}
public function handle(){
$args = $this->arguments();
$this->info($args['phone'].' '.$args['name']);
}
}
The issue is, when i call the command by php artisan Call:SomeCommand phone="8980151878" name="Anubhav Rane"
. It outputs the arguments with keypair value as name=Anubhav Rane
& phone=8980151878
. It should only output the values.
I also tried catching single values by $this->argument('phone')
and $this->argument('name')
but still it outputs the same.
Upvotes: 2
Views: 652
Reputation: 2657
The way you're passing the arguments is incorrect. Try this:
php artisan Call:SomeCommand 8980151878 'Anubhav Rane'
Upvotes: 4