robertoandres24
11/11/2016 - 10:39 PM

Components And Slots

Components And Slots

<html>
    <head>
        <title>{{ $title or 'Default Title' }}</title>

        <style>
            div.alert {
                color: red;
            }
        </style>
    </head>

    <body>
        <h1>My Application</h1>

        <div class="container">
            {{ $slot }}
        </div>
    </body>
</html>
@component('zonda.layout')
    @slot('title')
        Customized Page Title
    @endslot

    <div>
        @component('zonda.alert')
            This is the alert message here.
        @endcomponent

        This is the content that gets injected into the page.
    </div>
@endcomponent
<div class="alert">
    {{ $slot }}
</div>