Skip to content

Instantly share code, notes, and snippets.

@devig
Created March 3, 2019 16:39
Show Gist options
  • Save devig/14cff4c3762376c7ff0f3cfbd05f74f8 to your computer and use it in GitHub Desktop.
Save devig/14cff4c3762376c7ff0f3cfbd05f74f8 to your computer and use it in GitHub Desktop.
laravel artisan make:command
<?php
//php artisan make:command Price
//php artisan price:update p1 param2 array_param1 array_param2 --queue
namespace App\Console\Commands;
use Illuminate\Console\Command;
class Price extends Command
{
protected $signature = 'price:update {param1} {param2} {array_param*} {--queue}'; //--queue не выводит // {optional?}
protected $description = 'Update price';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$param1 = $this->argument('param1');
$param2 = $this->argument('param2');
$arguments = $this->arguments();
print_r($arguments);
//echo "price updated {$param1} {$param2}!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment