예제 #1
0
 public function destroy(Request $request)
 {
     try {
         if ($request->input('id') == "") {
             throw new ListItemException('destroy : list id can\'t be null');
         }
         $userid = Auth::user()->id;
         $listid = $request->input('id');
         $listItem = ListItem::where('id', $listid)->where('belong', $userid)->first();
         $listItem->isuse = 0;
         $listItem->save();
         return Response()->json(['errno' => 0, 'type' => 'succ', 'msg' => (object) array()]);
     } catch (ListItemException $e) {
         return Response()->json(['errno' => 2, 'type' => 'fail', 'msg' => $e->getMessage()]);
     } catch (Exception $e) {
         Log::error($e);
         return Response()->json(['errno' => 1, 'type' => 'fail', 'msg' => 'Whoops, looks like something went wrong']);
     }
 }
예제 #2
0
 public function destroy($id)
 {
     $note = ListItem::find($id);
     $note->delete();
     return Response::json('Note Deleted', 200);
 }