Simple Relation Ship Help

Posted 3 years ago by Crazy_Boy

Guys how can i convert my join to relationship Here is the Function

public function myView()
{
     $auth_id =  Auth::user()->id;
     $user_diets = DB::table('diets')->leftJoin('user_diets', 'diets.id', '=', 'user_diets.diet_id')->where('user_diets.user_id', '=', $auth_id)->orderBy('user_diets.id','DESC')->paginate('15');
     return view('Front.submit_diet.view')->with(['user_diets'=>$user_diets]);
}

How I convert this query using relationship.

Please sign in or create an account to participate in this conversation.