public function fire() { $this->comment('Groups:'); $groups = Group::all(); if ($groups->isEmpty()) { $this->comment('There are no groups.'); exit; } foreach ($groups as $group) { $message = ''; $users = $group->users; if ($this->option('with-users')) { if ($users->isEmpty()) { $message .= ' No users.'; } else { foreach ($users as $user) { $message .= " {$user->username}"; } } } $this->info("{$group->name}<comment>{$message}</comment>"); } }