A. Missing @endsection to close the content section
B. Incorrect use of @extends directive
C. Cannot use HTML inside @section
D. Should use @yield instead of @section
Solution
Step 1: Check section syntax completeness
The @section('content') directive must be closed with @endsection to mark the end of the content block.
Step 2: Identify missing closing directive
The code snippet lacks @endsection, causing a syntax error or unexpected behavior.
Final Answer:
Missing @endsection to close the content section -> Option A
Quick Check:
Always close @section with @endsection [OK]
Hint: Always pair @section with @endsection [OK]
Common Mistakes:
Forgetting to close @section
Thinking @yield defines content
Believing HTML is not allowed inside sections
5. You have a base layout with multiple @yield placeholders: title, header, and content. You want to create a child view that fills only content and uses a default title and header from the layout. How should you write the child view?
hard
A. @extends('layouts.base')
@yield('title')
@yield('header')
@section('content')
Page content here
@endsection
B. @extends('layouts.base')
@section('content')
Page content here
@endsection
C. @extends('layouts.base')
@section('title', 'Default Title')
@section('header', 'Default Header')
@section('content')
Page content here
@endsection
D. @extends('layouts.base')
@include('title')
@include('header')
@section('content')
Page content here
@endsection
Solution
Step 1: Understand default content in layout
If the base layout provides default content for title and header, you don't need to override those sections in the child view.
Step 2: Write child view with only needed sections
Only define the content section in the child view to fill that placeholder, leaving others to default.
Final Answer:
Child view extends layout and defines only content section -> Option B
Quick Check:
Define only needed sections; others use layout defaults [OK]
Hint: Only override sections you want to change in child views [OK]
Common Mistakes:
Overriding sections unnecessarily
Using @yield inside child views
Trying to include sections with @include
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.