Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function send()
 {
     $data = ['user_id' => $this->from, 'alerted_user_id' => $this->to, 'content_type' => $this->contentType, 'content_id' => $this->contentId, 'view' => $this->view, 'extra_data' => $this->data];
     $validator = app('validator')->make($data, AlertModel::$rules);
     if ($validator->fails()) {
         return false;
     }
     return AlertModel::create($data);
 }
 /**
  * Get notification messages for user.
  * 
  * @param int $userId
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function user($userId)
 {
     return Models\Alert::where('user_id', '=', $userId);
 }