Как передать параметры в функцию handle() в командах Laravel Artisan?Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Как передать параметры в функцию handle() в командах Laravel Artisan?

Сообщение Anonymous »

Я создаю специальную команду Artisan в Laravel, и мне нужно передать параметры в функцию handle(). Однако я не уверен, как определить и получить доступ к этим параметрам при запуске команды.
Вот что у меня есть:

Код: Выделить всё

class UpdatePlacesImages extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:update-places-images';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch places data(specially images) from Places API and save it in the goog_data field';

/**
* Execute the console command.
*/
public function handle()
{
/* We are updating google_data field by using two separate functions
1: updatePlacesImages()
Updating ""google_data"" field using ""place_id"" for all places ""Expect Lounges"" because Lounges places
are stored in table name ""lounges"" and DB name ""newairport"" while the remaining all places are
saved in table name ""places"" and DB name ""airport_remote

2: updateLoungesImages()
Updating ""google_data"" field using ""place_id""  only for lounges place
*/

$this->updatePlacesImages();
$this->updateLoungesImages();
}
}
Чего я хочу:
1: я хочу передать параметр places или lounges >.
Пример:
1: php artisan app:update-places-images Places
или
2: мастер PHP app:update-places-images залы ожидания

Подробнее здесь: https://stackoverflow.com/questions/792 ... n-commands
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»