Back

Hey Laravel Developers

I want to introduce you to the Dumpable trait that comes with Laravel.

This trait can be added to any of your custom classes, allowing you to chain the dump() and dd() methods on objects of that class.

By default, when you call dd() or dump() on an object, it prints the current object.

You can also pass additional variables to the chained dump() and dd() calls to print them as well.

This same trait is internally used by Laravel, which is why the Request, HTTP and other classes exhibit similar behaviour.

image

43

0 / 1000