where('expired_at', '<=', Carbon::now()->format('Y-m-d H:i:s')) ->get(); $bans->each(function ($ban) { $ban->created_by->fill(['banned_at' => null])->save(); $ban->delete(); }); $this->info("Unbanned {$bans->count()} users."); return Command::SUCCESS; } }