Laravel Blade Template


What is blade file in laravel?

The laravel uses a powerful blade templating engine. The Blade view files use the .blade.php file extension and are typically stored in the resources/views directory.

Laravel create blade template layout

Create a master layout

Create an app.blade.php file in the resources/views/layouts directory.

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

Extend Laravel Layout

When extending the child view, that time we use the @extends Blade directive to inherit the child view. so you can see our home.blade.php file

@extends('layouts.app')

@section('title', 'Home Page')

@section('content')
    <p>This is home page.</p>
@endsection