Hello dear collegues,
I am busting my head with how to debug this. I've landed one project in UK and the guys have on the frontend Angular 1 and on the backend Laravel 5.5 API. The question is pretty simple, how can I debug the call from frontend to my backend in PhpStorm?
Here are the files you might need to understand it better in images:
The first one is making a request towards the API with the route `api/user/rfq`.
The api.php file looks like this:
And this leads us to `UserController and createRfq` function.
Ok and now when the user on frontend clicks submit I want that Phpstorm catches this debug break point so I can debug it. But sadly I can't make it work. What I would like from the experts here is to hear how can this be done in an elegant way?
Now for the curious ones I managed to do it the old school way with Phpstorm, hacking the request and of course who else but Postman. Here is how I did it, but I don't like it, you'll see at once why.
In the UserController@createRfq I made `info(json_encode($request->all()))` that way I caught what was in the POST and had in JSON format. Look here (https://i.imgur.com/AIoU77y.png). This information I took and shipped over to Postman (https://i.imgur.com/266nTTE.png) and of course added to the URL legendary: `?XDEBUG_SESSION_START=1`, that way I was able to catch it the backend and it works for the time being, but I don't want to go back and forth writing to laravel.log the request and then port it to Postman to debug the app. Please guys help me out here. Thanks in advance.
P.S. I've solved it, just now.
As soon as I wrote it I thought that it might have been that this frontend mambo jumbo is compiled. So I went directly to the assets/js/main.js found the line that I needed and appended to it `?XDEBUG_SESSION_START=1`:
I reloaded the site, went through the form and guess what it's working perfectly now in Phpstorm and I got my breakpoint:
Ohh such a nice way to end the workweek.
Hope this will help somebody.