Laravel - Artisan Console - Retrieving Input

While your command is executing, you will likely need to access the values for the arguments and options accepted by your command. To do so, you may use the argument and option methods. If an argument or option does not exist, null will be returned:

    
    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $userId = $this->argument('user');
    
        //
    }
	

If you need to retrieve all of the arguments as an array, call the arguments method:

    
    $arguments = $this->arguments();
	

Options may be retrieved just as easily as arguments using the option method. To retrieve all of the options as an array, call the options method:

    
    // Retrieve a specific option...
    $queueName = $this->option('queue');
    
    // Retrieve all options as an array...
    $options = $this->options();