Beispiel #1
0
 /**
  * Send system message
  * @param string $title
  * @param string $message
  * @param string $type
  * @param mixed $data
  * @return bool
  */
 public static function send($title, $message, $type = null, $data = null)
 {
     //Add only 1 hour
     if (SystemMessage::find()->where(['and', ['title' => $title], ['>', 'created_at', strtotime('-1 hour')]])->count() > 0) {
         return true;
     }
     $message = new SystemMessage(['title' => trim($title), 'message' => trim($message), 'data' => $data, 'type' => $type]);
     return $message->save();
 }