I don't know what does putting a section inside another section do. In a Laravel project I'm reading, a Blade file's code is like this:
login.blade.php :
@extends('layout') @section('content')
@section('title', 'Log in')
Lots of content.
@endsection
In above, what's the point of having title section inside content section? How will it be different if title section is placed outside:
@extends('layout')
@section('title', 'Log in')
@section('content')
Lots of content.
@endsection
I tested, and both are producing same output (HTML source code).
layout.blade.php
<head><title>@yield('title')</title></head>
<body>@yield('content')</body>
Is there any case of layout.blade.php in which different outputs will be produced?
@sectionand@endsectionto the name@yieldplace holder on the extended template. This means it does not consider where its placed, but for clarity and readability, the second example is the right structure - Emeka Mbah