I'm using my back-end as an API only. How can I see what am I dd()-ing?

Viewed 373

Usually, when the front-end and back-end are mixed ( when not using front-end framework ), whenever I dd() any variable, the result of that dd() gets displayed on the page, however, now that I am using Vue.js for my front-end, I can't seem to figure out how to check what is inside a PHP variable at any given time. Does the result of the dd() get saved in a text file somewhere similar to the error logs? Laravel is also being used on the back-end if that matters.

3 Answers

Just do var_dump($variable_name) i.e

{{ var_dump($variable_name) }}

console.log() will work but it will work only via javascript. You can also use vue.js plugin in brouser.

Here is the link

click here for Vue.js devtools

after that on your browser(F12) u will find it from Vue tab together console,network html.

For development prupose i recommand you to use laravel dump-server whitch will dump all value on your console.

You can also configure it to export information on another file.

And for production prupose, Monolog or any log engine will be more relevant.

to test your API, you can use https://insomnia.rest or any API client , you only need to replace your dd() with a response->json() and it's better since you can specify headers and the request type.

Related