Hello everyone I want to load shopReq.blade.php file in master.blade.php and I am successful in doing this. But when I load modals.blade.php file in shopReq.blade.php it does not included. Am I doing something 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 I am in shopReq.blade.php
@yield(content)
@endsection
modals.blade.php (in views)
@extends('shopReq')
@section('content')
<h1>Hello I am in modals.blade.php
@endsection
web.php:
Route::group(['middleware' =>['web']], function()
{
Route::get('/', function () {
return view('welcome');
})->name('home');
});
replace @yield(content) on shopReq.blade.php with @include('modals')
modals.blade.php
<h1>Hello I am in modals.blade.php</h1>
on routes
return view('shopReq');
As the user milo526 has said.
You have @yield('content') twice.
For any blade directive (yield, section, component...)
if there is a same name inside brackets it will be overwritten.
And now I have spot that you don't have the quotes ' ' on your second yield:
@yield(content)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With