Example #1
0
 public function Purge()
 {
     $retention = Settings::get('retention', 30);
     $retentionDate = date('Y-m-d H:i:s', strtotime('-' . $retention . ' day'));
     $protectRows = MessageMax::lists('row_id');
     Message::whereNotIn('id', $protectRows)->where('sent_at', '<', $retentionDate)->where('read', 1)->delete();
 }
Example #2
0
 public function beforeSave()
 {
     if ($this->send && !$this->sent_at) {
         $this->sent_at = Carbon::now();
     }
     if (!$this->lang) {
         $this->lang = Settings::get('auth_lang', 'en');
     }
 }
Example #3
0
 public function autoRetrieve()
 {
     if (Settings::get('auto_retrieve', 0)) {
         $retriever = new Retriever();
         $retriever->Retrieve();
     }
     if (Settings::get('auto_purge', 0)) {
         $this->Purge();
     }
 }
Example #4
0
 /**
  * Makes a request to the plugin authors message service
  */
 public function update($id)
 {
     parent::update($id);
     $this->vars['lang'] = Settings::get('read_lang', 'en');
 }