/** * Handle the event. * * @param CreateComment $event * @return void */ public function handle(CreateComment $event) { $nottifiactions = new Nottifications(); $nottifiactions->obj_type = $event->objType; $nottifiactions->obj_id = $event->objId; $nottifiactions->user_id = $event->userId; $nottifiactions->comment_id = $event->commentId; $nottifiactions->save(); }
/** * @GET("/nottifications/{id}/delete/", as="nottifications.destroy") */ public function destroy($id) { $model = Nottifications::where('id', $id)->first(); if ($model->user->id != Auth::user()->id) { App::abort(404); } else { $model->delete(); } }