where('status','active')->get(); foreach ($customerSubscriptions as $subscription) { $expiredDate = Carbon::parse($subscription->expired_at); $nowDate = Carbon::now(); if ($nowDate->gt($expiredDate)) { $subscription->update([ 'status' => 'expired' ]); } } return true; } /** * Get the console command arguments. * * @return array */ protected function getArguments() { return [ ['example', InputArgument::REQUIRED, 'An example argument.'], ]; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], ]; } }