Why this lesson matters
Understand layouts and components and apply it in a small Laravel feature. Blade is server-rendered presentation: layouts remove repeated page chrome, components package reusable UI, and form helpers preserve security and validation feedback.
How to reason about it
- For Layouts and Components, the outcome to verify is: CSRF protection and repopulating old input are part of a reliable form flow.
- In Layouts and Components, keep this failure controlled: Putting queries or business decisions inside Blade templates couples presentation to data access and makes behavior hard to verify.
- Layouts and Components practice target: Build a form page from a layout and reusable component, including CSRF protection and validation-error output.
Practical walkthrough
In the Layouts and Components walkthrough: CSRF protection and repopulating old input are part of a reliable form flow.
resources/views/users/create.blade.phpblade
<form method="POST" action="{{ route('users.store') }}">
@csrf
<input name="name" value="{{ old('name') }}">
<button type="submit">Save</button>
</form>Practice it yourself
Layouts and Components exercise
Build a form page from a layout and reusable component, including CSRF protection and validation-error output.
- Record the expected result before execution
- Test one valid path and one lesson-specific failure path
- Explain in two lines which boundary owns the decision
