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(); }
public function beforeSave() { if ($this->send && !$this->sent_at) { $this->sent_at = Carbon::now(); } if (!$this->lang) { $this->lang = Settings::get('auth_lang', 'en'); } }
public function autoRetrieve() { if (Settings::get('auto_retrieve', 0)) { $retriever = new Retriever(); $retriever->Retrieve(); } if (Settings::get('auto_purge', 0)) { $this->Purge(); } }
/** * Makes a request to the plugin authors message service */ public function update($id) { parent::update($id); $this->vars['lang'] = Settings::get('read_lang', 'en'); }