M a m a D
M a m a D

Reputation: 2139

Laravel access url in RedirectResponse

I am using a payment package which returns an instance of RedirecResponse class, then the user is redirected to the payment page.

I need to use this in a mobile application. I don't know how to tell the application to open that paying page. I can't return the instance of RedirecResponse to the application, therefore I have to get the url of the payment page from the instance of RedirecResponse and then return it to the application, then application must open the browser.

The TargetUrl property contains the url but Laravel returns the following error while accessing this:

Cannot access protected property Illuminate\Http\RedirectResponse::$targetUrl

How can I get the url from RedirectResponse?

Thanks

Upvotes: 0

Views: 1927

Answers (2)

NoOorZ24
NoOorZ24

Reputation: 3222

As confirmed:

$redirectResponse->getTargetUrl()

does the trick

Upvotes: 6

Niket Joshi
Niket Joshi

Reputation: 748

You can add $redirectResponse->getTargetUrl() something like this to get redirect response.

Upvotes: 4

Related Questions