public function destroy($id)
 {
     // delete single
     $record = Notification::findOrFail($id);
     $record->delete();
     return $this->respondOK('Notification was deleted');
 }
Ejemplo n.º 2
0
 public function reviewed($notificationId, Request $request)
 {
     $notification = Notification::findOrFail($notificationId);
     if ($notification->user_id != $this->user->id) {
         if ($request->ajax()) {
             return ['result' => false];
         } else {
             return Redirect::back()->withErrors(['access' => 'You have no right for this']);
         }
     }
     $result = NotificationMapper::reviewed($notification);
     if ($request->ajax()) {
         return ['result' => $result];
     } else {
         if ($result) {
             return Redirect::back()->with(['success' => 'You have no right for this']);
         } else {
             return Redirect::back()->withErrors(['general' => 'Something was wrong']);
         }
     }
 }
 /**
  * Delete the notification
  * @param $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $notification = Notification::findOrFail($id);
     $notification->delete();
     return $this->responseNoContent();
 }