Skip to content

Instantly share code, notes, and snippets.

@taylorotwell
Created November 11, 2016 22:39
Show Gist options
  • Save taylorotwell/03ba853aa9ee1d1bf197c42dcaa559e3 to your computer and use it in GitHub Desktop.
Save taylorotwell/03ba853aa9ee1d1bf197c42dcaa559e3 to your computer and use it in GitHub Desktop.
Components And Slots
<div class="alert">
{{ $slot }}
</div>
@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
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment