/** * Execute the console command. * * @return mixed */ public function handle() { $birthDay = Client::whereHappyBirth(); foreach ($birthDay as $b) { $user = ['name' => $b->name, 'email' => $b->email]; Mail::send('mail.birthday', $user, function ($m) use($user) { $m->from('*****@*****.**', 'Cartório Ayache'); $m->to($user["email"], $user["name"])->subject("Parabéns, " . $user["name"]); }); } $this->info("Thank you for your message. It has been sent."); }
/** * Execute the console command. * * @return mixed */ public function handle() { if (date('m') == 12 && date('d') >= 15 && date('d') <= 25) { $clients = Client::select('name', 'email')->get(); $news = Newsletter::select('name', 'email')->get(); foreach ($clients as $client) { $name = $client->name; Mail::send('mail.merrychristmas', compact('name'), function ($message) use($client) { $message->subject($client->name . ', nós não esquecemos de você.')->from('*****@*****.**', 'Cartório Ayache')->to($client->email, $client->name); }); } foreach ($news as $new) { $name = $new->name; Mail::send('mail.merrychristmas', compact('name'), function ($message) use($new) { $message->subject($new->name . ', nós não esquecemos de você.')->from('*****@*****.**', 'Cartório Ayache')->to($new->email, $new->name); }); } $this->info('Christmas messages sent successfully'); } else { $this->info('We are not in the Christmas epoch'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $status = Client::destroy($id); if ($status) { $st = true; } else { $st = false; } return response()->json(['status' => $st]); }
/** * {@inheritDoc} */ public function __unset($name) { $this->__initializer__ && $this->__initializer__->__invoke($this, '__unset', array($name)); return parent::__unset($name); }