getting_started_with_laravel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revisionBoth sides next revision
getting_started_with_laravel [04.12.2020 11:16] – [Create Model + Controller + Migration all in one step] Pascal Sutergetting_started_with_laravel [04.12.2020 11:19] – [dump / dump and die] Pascal Suter
Line 195: Line 195:
 you may not always want to stop the execution, so another helper called ''dump()'' comes in handy here. it produces the same output but contines the execution of your script  you may not always want to stop the execution, so another helper called ''dump()'' comes in handy here. it produces the same output but contines the execution of your script 
  
-the latter is especially helpful when dumping variables in a blade. howeverif you use  +to use those helpers in a blade, there are special blade syntax helpers available which make it even easier:  
-<code> +<code>@dump($__data)</code> 
-{{ dump($__data) }} +for example dumps all defined variables. there is also ''@dd()'' helper available
-</code> +
-for example to get a dump of all defined variables in your blade, you are going to run into laravel error which tells you that htmlspecialchars only works with strings but got something else (an array most likely).+
  
-so to use dump in a blade, you can use a blade syntax ''@dump()'' which does what the above is supposed to do but does not generate this error. a detailed explanation why the error is generated is available [[https://stackoverflow.com/questions/48731507/laravel-dump-unexpected-output|on stackexchange]]+note that using <code>{{ dump($__data}}</code> won't work. there is a detailed explanation why [[https://stackoverflow.com/questions/48731507/laravel-dump-unexpected-output|on stackexchange]]
 ==== Create Model + Controller + Migration all in one step ==== ==== Create Model + Controller + Migration all in one step ====
   artisan make:model Pizza -mc   artisan make:model Pizza -mc
  • getting_started_with_laravel.txt
  • Last modified: 04.12.2020 11:44
  • by Pascal Suter