public function index($userId)
    {
        $user = User::with('phones')
            ->findOrFail($userId);
        $this->authorize('view', $user);
        return fractal($user->phones, new PhoneTransformer())
            ->withResourceName('userPhone')
            ->respond();
    }
public function index($userId)
    {
        $user = User::with('phones')
            ->findOrFail($userId);
        $this->authorize('view', $user);
        return fractal($user->phones, new PhoneTransformer())
            ->withResourceName('userPhone')
            ->respond();
    }
public function index ( $ userId ) { $ user = User :: with ( 'phones' ) -> findOrFail ( $ userId ) ; $ this -> authorize ( 'view' , $ user ) ; return fractal ( $ user -> phones , new PhoneTransformer ( ) ) -> withResourceName ( 'userPhone' ) -> respond ( ) ; }
Produce a list of Phones related to a selected User

@param $userId string UUID of User
@return \Illuminate\Http\Response List of Phones
Produce a list of Phones related to a selected User