コード例 #1
0
ファイル: Purge.php プロジェクト: firemankurt/authnotice
 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();
 }
コード例 #2
0
ファイル: Retrieve.php プロジェクト: firemankurt/authnotice
 public function insertMessages($data)
 {
     //var_dump($data);
     $HighestId = $rowId = 0;
     if (!is_array($data) || count($data) <= 0) {
         return;
     }
     foreach ($data as $message) {
         if (!is_array($message)) {
             return;
         }
         $msg = $this->insertNewMessage($message);
         // Find Highest Id in all messages
         if ($HighestId < $message['id']) {
             $HighestId = $message['id'];
             $rowId = $msg->id;
         }
     }
     // Update if there is new Highest ID
     if ($HighestId > 0) {
         $messMax = MessageMax::where('plugin', $this->plugin)->first();
         if (!$messMax) {
             $messMax = new MessageMax();
             $messMax->plugin = $this->plugin;
         }
         $messMax->max_id = $HighestId;
         $messMax->row_id = $rowId;
         $messMax->save();
     }
 }