Have you ever written a block of code like this?
$users = User::all();
dd($users);
It’s not awful, but it is annoying that you need to assign the result of User::all()
(an instance of Collection
) to a variable just to dump and die. Turns out, you don’t actually need to. Instead, you can use the dd
or dump
method on the Collection
class instead and turn this into a one-liner.
#laravel