Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
getting_started_with_laravel [03.12.2020 15:38] – [Tricks] Pascal Suter | getting_started_with_laravel [04.12.2020 11:19] – [dump / dump and die] Pascal Suter | ||
---|---|---|---|
Line 153: | Line 153: | ||
<code php> | <code php> | ||
public function store(Request $request){ | public function store(Request $request){ | ||
- | $validateData | + | $validData |
' | ' | ||
' | ' | ||
Line 161: | Line 161: | ||
} | } | ||
</ | </ | ||
+ | there are many [[https:// | ||
+ | |||
+ | also note, that the '' | ||
now here are a few cool things about the validator: | now here are a few cool things about the validator: | ||
Line 166: | 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 blade with a form that will show some info if the validation fails: | + | here's an example part of a (bootstrap based) |
<code html> | <code html> | ||
Line 180: | Line 183: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
<div class=" | <div class=" | ||
</ | </ | ||
Line 187: | 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 '' | ||
+ | |||
+ | to use those helpers in a blade, there are special blade syntax helpers available which make it even easier: | ||
+ | < | ||
+ | for example dumps all defined variables. there is also a '' | ||
+ | |||
+ | note that using < | ||
==== 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 | ||
Line 221: | Line 234: | ||
@extends(' | @extends(' | ||
</ | </ | ||
- | and in the layout you would then simply use '' | + | and in the layout you would then simply use < |
=== 2.) create a mini-section === | === 2.) create a mini-section === |