Master/fixed layout in Laravel.

@yield(“Parameter”) :- It is a section which requires to be filled in by your view which extends the layout. You could pass it a default value through the second parameter if you’d like.

@section(“Parameter”):- It is a section which is used to fill HTML content in view to extends the layout.

Below example is master layout program, in which all content is fixed but title and body are dynamic which is extend by other view.

Below program is product.blade.php page which extends master layout and assigns title and body as required.

After that, we have to declare a function in the controller so that it returns the address of view. See below:-

After that, we have to route the controller and function into web.php. See the below image:-

Now run the server and copy the address and add products in it and hit enter. See the output below:-