/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $books = Book::with('user')->where('taken_at', '<', date('Y-m-d H:i:s', time() - 2592000))->get();
     /** @var Book[] $books */
     foreach ($books as $book) {
         $this->mailer->raw(sprintf("Hi %s,\nPlease return back %s by %s.\nRegards,\nYour Library", $book->user->first_name, $book->title, $book->author), function ($message) use($book) {
             $message->subject('Reminder');
             $message->from(getenv('EMAIL_FROM'));
             $message->to($book->user->email);
         });
     }
 }
Esempio n. 2
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $message_text = "Hello, {$this->user->firstname}, you should return the book, since 30 days have passed from the time when you took the book '{$this->book->title}'";
     $mailer->raw($message_text, function ($message) {
         $message->subject('Return your book');
         $message->from('*****@*****.**', 'Reminder');
         $message->to($this->user->email);
     });
 }
Esempio n. 3
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $users = User::all();
     $message_text = "Hello, new book was add to our library: '{$this->book->title}' by {$this->book->author}";
     foreach ($users as $user) {
         $mailer->raw($message_text, function ($message) use($user) {
             $message->subject('New book add to the library');
             $message->from('*****@*****.**', 'Admin');
             $message->to($user->email);
         });
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $users = Model\User::all(['first_name']);
     /** @var Model\User[] $users */
     foreach ($users as $user) {
         $mailer->raw(sprintf("Hi %s,\nWe have a new book %s by %s.\nRegards,\nYour Library", $user->first_name, $this->book->title, $this->book->author), function ($message) use($user) {
             $message->subject('Brand new book');
             $message->from(getenv('EMAIL_FROM'));
             $message->to($user->email);
         });
     }
 }
Esempio n. 5
0
 /**
  * Send a new message when only a raw text part.
  *
  * @param string $text
  * @param mixed $callback
  * @return int 
  * @static 
  */
 public static function raw($text, $callback)
 {
     return \Illuminate\Mail\Mailer::raw($text, $callback);
 }
 /**
  * Send a template email.
  *
  * @param $template
  * @param $data
  * @return bool
  */
 public function send($template, $data)
 {
     return $this->mailer->raw($template, $data);
 }
Esempio n. 7
0
 /**
  * Send a new message when only a raw text part.
  *
  * @param string $text
  * @param \Closure|string $callback
  * @return int
  */
 public function raw($text, $callback)
 {
     return $this->mailer->raw($text, $callback);
 }