/** * Send event to sms, browser or some else * @return mixed */ public function send() { try { $browser = new BrowserEvent(['title' => $this->getTitle(), 'text' => $this->getText(), 'from_user_id' => 1, 'to_user_id' => $this->user->id]); $browser->save(); } catch (\Exception $e) { $this->sendError($e); } }
/** * @param $id * @return BrowserEvent * @throws HttpException */ protected function findModel($id) { $model = BrowserEvent::findOne(['id' => $id]); if ($model == null) { throw new HttpException(404); } return $model; }