Beispiel #1
0
 public function mark_as_read()
 {
     $this->updateAttribute('has_seen', true);
     if (!Dmail::where("to_id = ? AND has_seen = false", current_user()->id)->exists()) {
         current_user()->updateAttribute('has_mail', false);
     }
 }
Beispiel #2
0
 public function markAllRead()
 {
     if ($this->params()->commit == "Yes") {
         foreach (Dmail::where("to_id = ? and has_seen = false", $this->current_user->id)->take() as $dmail) {
             $dmail->updateAttribute('has_seen', true);
         }
         $this->current_user->updateAttribute('has_mail', false);
         $this->respond_to_success("All messages marked as read", ['action' => "inbox"]);
     } else {
         $this->redirectTo("#inbox");
     }
 }