How to identify the data type returned from a controller?

0

I noticed that when creating a controller in Laravel it says that some methods will return a \Illuminate\Http\Response object.

I used a dd () at the end of the method and saw the following return: \Illuminate\View\View and in another method \Illuminate\Http\RedirectResponse

In this case, when documenting methods should I always consider: \Illuminate\Http\Response or can I insert the visualized object into the output of the dd() method?

    
asked by anonymous 01.10.2017 / 21:36

1 answer

0

You can use instanceof of PHP

if ($objeto instanceof \Illuminate\Http\Response) {
    ... faz algo aqui ...
} else if ($objeto instanceof \Illuminate\View\View) {
    ... faz algo aqui ...
}
    
01.10.2017 / 22:16