Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What are the Steps for Creating a Blade Template Layout ?



What are the Steps for Creating a Blade Template Layout ?..

Answer / rachana devi

Step 1 :

Create a layout folder inside the resources/views folder. We are going to use this folder to store all layouts together.

Create a file name master.blade.php which will have the following code associated with it -

<html>
<head>
<title>DemoLaravel - @yield('title')</title>
</head>
<body>
@yield('content')
</body>
</html>

Step 2 :

In this step, you should extend the layout.
Extending a layout involves defining the child elements.
Laravel uses the Blade @extends directive for defining the child elements.
When you are extending a layout, please note the following points -

Views defined in the Blade Layout injects the container in a unique way.
Various sections of view are created as child elements.
Child elements are stored in layouts folder as child.blade.php.

An example that shows extending the layout created above is shown here -
@extends('layouts.app')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This refers to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection

Step 3 :

To implement the child elements in views, you should define the layout in the way it is needed.

Named route is used to give specific name to a route. The name can be assigned using the as array key.

Route::get('user/profile', ['as' => 'profile', function () {
//
}]);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

What are redirect responses?

0 Answers  


How to set login page as default page in laravel?

0 Answers  


Explain how to upgrade valet to valet 2.0?

0 Answers  


What is meant by Modularity ?

0 Answers  


Explain how to configure cron jobs in homestead?

0 Answers  


How to write html code in laravel controller?

0 Answers  


Name aggregates methods of query builder.

0 Answers  


Why should I use laravel?

0 Answers  


Where do you regiser service providers?

0 Answers  


List site types supported by homestead?

0 Answers  


Do you know what is luman?

0 Answers  


Provide the steps to configure laravel application?

0 Answers  


Categories