[ad_1]
I’m new to Laravel and PHP in general and was wondering how I could paginate the tweets data in my example below:
Route::get("/users/{user}", function (User $user) {
return $user->only(
"id",
"name",
"username",
"avatar",
"profile",
"location",
"link",
"linkText",
"created_at",
"tweets"
);
});
The tweets
table is related to user
so I could say $user->tweets()->paginate(10);
but how can I return that along with my only()
method? also, is there a way for me to return multiple stuffs and can still access them on my frontend?
[ad_2]