Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
getting_started_with_laravel [03.12.2020 15:46] – [passing variables from content blades to layouts] Pascal Suter | getting_started_with_laravel [04.12.2020 11:16] – [Create Model + Controller + Migration all in one step] Pascal Suter | ||
---|---|---|---|
Line 169: | Line 169: | ||
* in addition to bringing the user back to the form, laravel will provide an '' | * in addition to bringing the user back to the form, laravel will provide an '' | ||
* even better, there is a '' | * even better, there is a '' | ||
+ | * you also get a '' | ||
here's an example part of a (bootstrap based) blade with a form that will show some info if the validation fails: | here's an example part of a (bootstrap based) blade with a form that will show some info if the validation fails: | ||
Line 183: | Line 183: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
<div class=" | <div class=" | ||
</ | </ | ||
Line 190: | Line 190: | ||
===== Tricks ===== | ===== Tricks ===== | ||
+ | ==== dump / dump and die ==== | ||
+ | this has to be the first tip :) .. there is a helper function called '' | ||
+ | |||
+ | you may not always want to stop the execution, so another helper called '' | ||
+ | |||
+ | the latter is especially helpful when dumping variables in a blade. however, if you use | ||
+ | < | ||
+ | {{ dump($__data) }} | ||
+ | </ | ||
+ | for example to get a dump of all defined variables in your blade, you are going to run into a 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 '' | ||
==== 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 |