Build a Monthly Subscription App with Laravel Cashier: Lesson 7 of 36

Blade Templating

Up Next

Home HTML

Autoplaying in 7 seconds!

Cancel

Laravel Blade makes it very easy to use a single layout across all your application. This way you don't have to repeat code in multiple places.

Create three folders:

- views/layouts
- views/pages
- views/partials

For a page to use a certain layout, add the following to the top of the file:

Table of Contents

    @extends('layouts.app')

    To include child views (partials):

    @include('partials.header')

    To pass in a content section:

    
    // in the layout file
    @yield('content')
    
    // in the page file
    @section('content')
        i am the content
    @endsection

    Chris Sevilleja

    173 posts

    Founder of Scotch.io. Google Developer Expert in Web Technologies. Slapping the keyboard until something good happens.