*/ protected function promptForMissingArgumentsUsing(): array { return [ 'portfolio_id' => fn () => search( label: 'Choose the portfolio you wish to re-calculate:', placeholder: 'E.g. My favorite stocks', options: fn ($value) => strlen($value) > 0 ? Portfolio::where('title', 'like', "%{$value}%")->pluck('title', 'id')->all() : [] ), ]; } /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { try { $portfolio = Portfolio::findOrFail($this->argument('portfolio_id')); $portfolio->syncDailyChanges(); $this->line('Awesome! Daily change history for '. $portfolio->title .' has been completed.'); } catch (\Throwable $e) { $this->error($e->getMessage()); } } }