Answer the question
In order to leave comments, you need to log in
What is the easiest way to get related data?
What is the easiest way to get related data?
$result=$article->comments()->OrderBy('id','desc')->skip($skip)->take($limit)->get();
$res=$article->comments()->OrderBy('id','desc')->skip($skip)->take($limit)->User->get()
$res->user->name
$res=$article->comments()->OrderBy('id','desc')->skip($skip)->take($limit)->User->get()
like this. there will be two queries Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question