Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserController
- {
- public function posts(User $user)
- {
- return $user->load(['username', 'name', 'posts.body' // solution one
- return $user->load(['username', 'name', 'posts'=>function($q){
- $q->select(['body']
- }])// solution two
Add Comment
Please, Sign In to add comment