Recall & Review
beginner
What is Blade in Laravel?
Blade is Laravel's simple, yet powerful templating engine that helps you write HTML templates with embedded PHP code using clean and readable syntax.
Click to reveal answer
beginner
How do you output a variable safely in Blade?
Use double curly braces like
{{ $variable }}. This escapes HTML to prevent security issues like XSS.Click to reveal answer
beginner
How do you write an if-else condition in Blade?
Use directives:
@if(condition) ... @elseif(condition) ... @else ... @endif.Click to reveal answer
beginner
What Blade directive is used to loop over an array or collection?
Use
@foreach($items as $item) ... @endforeach to loop through each item.Click to reveal answer
beginner
How do you include one Blade template inside another?
Use the
@include('view.name') directive to insert one template inside another for reusability.Click to reveal answer
Which Blade syntax outputs a variable with HTML escaped?
✗ Incorrect
Using {{ $variable }} escapes HTML to keep output safe.
How do you start a Blade loop over a list called $users?
✗ Incorrect
The correct directive to loop over collections is @foreach.
Which directive ends an if statement in Blade?
✗ Incorrect
Use @endif to close an if block in Blade.
How do you include a Blade template named 'header'?
✗ Incorrect
Use @include to insert one Blade template inside another.
What does {!! $variable !!} do in Blade?
✗ Incorrect
The {!! !!} syntax outputs raw HTML without escaping, so use carefully.
Explain how to write conditional statements in Blade templates.
Think about how you check conditions in normal PHP but with Blade directives.
You got /4 concepts.
Describe how to safely display user input in a Blade template and why it matters.
Consider what happens if user input contains HTML or scripts.
You got /4 concepts.