/** * Execute the console command. * * @return mixed */ public function handle() { $tickets = Ticket::whereDate('created_at', '=', date('Y-m-d'))->where('open', 1)->get(); if (!$tickets->isEmpty()) { Mail::send('tickets::emails.not_replied', compact('tickets'), function ($message) use($tickets) { $emails = User::whereHas('permissions', function ($query) { $query->where('slug', 'notifications.tickets.tickets'); })->pluck('email'); // $message->from('*****@*****.**'); $message->subject('يوجد بطاقات مفتوحة.'); $message->cc('*****@*****.**'); foreach ($emails as $email) { $message->cc($email); } }); } }