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

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