argument('amount'); if(is_numeric($amount)) { $users = User::all(); try { $users->each(function($user) use ($amount) { $newPayment = new Payment; $newPayment->user_id = $user->id; $newPayment->amount = $amount; $newPayment->payment_type = Payment::PAYMENT_TYPE_GIFT; $newPayment->save(); }); } catch (\Throwable $th) { Log::info('Artisan make gift to users: ' . $th->getMessage()); $this->error($th->getMessage()); } } else { $this->info('the argument should be a number'); } } /** * Get the console command arguments. * @return array */ protected function getArguments() { return [ ['amount', InputArgument::REQUIRED, 'An amount of the gift payment.', 100] ]; } /** * Get the console command options. * @return array */ protected function getOptions() { return []; } }