php - @yield, @section in Laravel -
hello want load shopreq.blade.php
file in master.blade.php
, successful in doing this. when load modals.blade.php
file in shopreq.blade.php
not included. doing wrong here? please help.
master.blade.php (in views/layouts):
<html> <body > @yield('content') </body> </html>
shopreq.blade.php (in views)
@extends('layouts.master') @section('content') <h1>hello in shopreq.blade.php @yield(content) @endsection
modals.blade.php (in views)
@extends('shopreq') @section('content') <h1>hello in modals.blade.php @endsection
web.php:
route::group(['middleware' =>['web']], function() { route::get('/', function () { return view('welcome'); })->name('home'); });
as user milo526 has said.
you have @yield('content')
twice.
for blade directive (yield, section, component...)
if there same name inside brackets overwritten.
and have spot don't have quotes ' ' on second yield:
@yield(content)
Comments
Post a Comment