public function dismiss() { $user = Auth::user(); if (Input::has('all')) { // dismiss all $user->notifications()->update(array('dismissed' => true)); Session::flash('success', 'All notifications dismissed'); } else { // dismiss single $notifyId = Input::get('notification'); $notify = Notification::findOrFail($notifyId); if ($notify->user_id !== $user->id) { App::abort(403, 'That notification doesn\'t belong to you'); } $notify->dismiss(); } return Redirect::route('notifications'); }
/** * Update the specified notification in storage. * * @param int $id * @return Response */ public function update($id) { $notification = Notification::findOrFail($id); $validator = Validator::make($data = Input::all(), Notification::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $notification->update($data); // $alert = array( // 'alert-success' => '<strong><i class="fa fa-check"></i></strong> Notificação atualizada!' // ); $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Notificação atualizada!']; Session::flash('alerts', $alert); return Redirect::to(URL::previous()); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $notification = Notification::findOrFail($id); $notification->delete(); return Redirect::back()->with('success', 'Notificatie succesvol verwijdererd'); }