Bird
0
0

You want to create a layout with a default footer but allow child views to override it. Which Blade directives should you use in the layout?

hard📝 component behavior Q8 of 15
Laravel - Views and Blade Templates
You want to create a layout with a default footer but allow child views to override it. Which Blade directives should you use in the layout?
A@extends('footer') Default footer content @endsection
B@yield('footer') Default footer content
C@section('footer') Default footer content @show
D@include('footer') Default footer content
Step-by-Step Solution
Solution:
  1. Step 1: Understand default section content with override

    Using @section('footer') ... @show in a layout sets default content and allows child views to replace it.
  2. Step 2: Eliminate incorrect options

    @yield does not provide default content, @extends is for layouts, and @include inserts partials but doesn't allow override.
  3. Final Answer:

    @section('footer') Default footer content @show -> Option C
  4. Quick Check:

    Use @section + @show for default and override [OK]
Quick Trick: Use @section + @show for default content with override [OK]
Common Mistakes:
  • Using @yield expecting default content
  • Confusing @extends with section definition
  • Using @include instead of section for overrides

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes