/** * Execute the console command. * * @return mixed */ public function handle() { // Get quotations that are still fresh. $quotes = Quotation::where('State', '=', 'fresh')->get(); // Now check them. foreach ($quotes as $quote) { if (date('Y-m-d', strtotime($quote->Created) + 86400 * $quote->Life) < date('Y-m-d')) { $quote->State = 'expired'; $quote->save(); } } }