Answers for "command with parameter laravel"

PHP
1

how send parameter with command in laravel

1 ) protected $signature = 'testCommand:refresh {name} {option}';
2 ) php artisan help testCommand:refresh
3 ) Usage:
  testCommand:refresh <name> <option>
4 ) public function handle()
    {
        return $this->info('the name is => '.$this->argument('name'). " the option is =>" .$this->argument('option'));
    }
Posted by: Guest on July-15-2021
0

create command laravel sample parameter

// 1
protected $signature = 'add:itemstocat {keyword} {category_id}';
// 2
public function handle()
 {
     if ($this->confirm('This will run the command code continue?')) {
         // Do something here.
        $keyword = $this->argument('keyword');
        $category_id = $this->argument('category_id');
         // Do something here.
       
     }
Posted by: Guest on September-17-2021

Code answers related to "command with parameter laravel"

Browse Popular Code Answers by Language