예제 #1
0
 public function delete($id)
 {
     try {
         $token = Input::get('token');
         $email = Input::get('email');
         $link = Link::whereHas('user', function ($query) use($token, $email) {
             $query->where(['api_token' => $token, 'email' => $email]);
         })->where('id', $id)->first();
         if ($link->delete()) {
             return response()->json(['status' => 'success']);
         } else {
             throw new Exception('Link wasn\'t deleted!');
         }
     } catch (Exception $e) {
         return response()->json(['status' => 'false', 'message' => $e->getMessage()]);
     }
 }