Created
August 26, 2017 17:26
-
-
Save deleugpn/36302893ee0b4686553d8ca8cd29bb86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display a listing of the resource. | |
* | |
* @param User $user | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index(User $user) | |
{ | |
return UsersResource::collection($user->with('posts')->paginate()); | |
// If you don't want to include the relationship in your response, don't use with() | |
// return UsersResource::collection($user->paginate()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment