samedi 30 avril 2022

yield inside section in Laravel 8

Iam trying to yield a section inside another section whitch 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 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


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire