Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel, display dd() results without die -> d(), dump()?

I want to display the content of my session with the same style that the dd() function.

I try to do this :

<div>
    {!! dump(session()->all()) !!}
</div>

And i get this error :

Facade\Ignition\Exceptions\ViewException
Array to string conversion

I don't understand why, because dump() should be able to display an array, no ?

How can i manage this ? Thanks

like image 600
djoo Avatar asked Dec 10 '22 01:12

djoo


1 Answers

<?php dump(session()->all()) ?>

This is how you can display array in blade.

The { } are used to echo results (simple strings, integers etc etc) but as you know not suitable for arrays.

like image 158
pr1nc3 Avatar answered Jan 05 '23 19:01

pr1nc3