invoice = $invoice; } /** * Execute the console command. * * @return mixed */ public function handle() { $latestInvoice = $this->invoice->latest()->first(); $invoiceYear = Carbon::parse($latestInvoice->created_at)->year; if(Carbon::now()->year > $invoiceYear || $this->option('force')) { $account = Account::find($this->argument('account'))->first(); $account->invoice_number_counter = 1; $account->update(); $this->info('The counter has been resetted successfully.'); } } }