예제 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $reminders = Reminder::where('utcReminderDate', '<=', \Carbon\Carbon::now()->format('Y-m-d H:i'))->get();
     foreach ($reminders as $reminder) {
         $data = array('title' => $reminder->title, 'date' => $reminder->userReminderDate, 'description' => $reminder->description, 'name' => $reminder->user->firstname);
         Mail::send('emails.reminder', $data, function ($message) use($reminder) {
             $message->to($reminder->user->email, $reminder->user->firstname . ' ' . $reminder->user->lastname);
             $message->subject('A Friendly Remindr');
         });
         $moveReminder = new SentReminders();
         $moveReminder->id = $reminder->id;
         $moveReminder->memberid = $reminder->memberid;
         $moveReminder->title = $reminder->title;
         $moveReminder->userReminderDate = $reminder->userReminderDate;
         $moveReminder->utcReminderDate = $reminder->utcReminderDate;
         $moveReminder->description = $reminder->description;
         $moveReminder->save();
         Reminder::destroy($reminder->id);
     }
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Reminder::destroy($id);
     flash()->success('Remindr was successfully deleted.');
 }
예제 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Reminder::destroy($id);
     flash()->success('Your remindr was successfully deleted.');
     return redirect('/remindr');
 }