/**
  * iLife iOS Backend API No.10
  * @param Request $request
  * @return string
  */
 public function deleteFavoriteArticle(Request $request)
 {
     $article = Favorite_article::where('article_id', $request->article_id)->where('user_id', $request->user_id)->get();
     $user = User::find($request->user_id);
     if (is_null($article)) {
         //Check whether article exists
         $result = array('code' => 12, 'message' => 'user favorite is not found', 'data' => null);
         dd($result);
     } elseif (is_null($user)) {
         // Check user exists
         $result = array('code' => 13, 'message' => 'user id is not found', 'data' => null);
     } else {
         Favorite_article::where('article_id', $request->article_id)->where('user_id', $request->user_id)->delete();
         $result = array('code' => 1000, 'message' => 'Delete favorite succeed', 'data' => null);
     }
     return json_encode($result);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $deleted_favorite_article = Favorite_article::where('article_id', '=', $id)->where('user_id', '=', Auth::user()->id);
     $deleted_favorite_article->delete();
     \Session::flash('flash_message', 'Favorite article delete succeed!');
     return redirect('favorite_articles');
 }