I am trying to yield a section inside another section which is itself yielded in master.blade.php
, but it does not work.
master.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
welcome to X store
@yield('content')
</body>
</html>
shop.blade.php
(This is the view that I have called in the router) view('shop')
@extends('master')
@section('content')
<h1> Hello ! This is Shop page </h1>
@yield('products')
@endsection
products-grid.blade.php
=> this is the section that i want to yield in Shop view
@extends('shop')
@section('products')
<h3> product 1 </h3>
<h3> product 2 </h3>
<h3> product 3 </h3>
<h3> product 4 </h3>
@endsection
result
welcome to X store
Hello ! This is Shop page
CodePudding user response:
In products-grid.blade.php try @parent after @section('products')
CodePudding user response:
you can simply use
@include ('products-grid') instead of @yield('products')