Skip to content

Instantly share code, notes, and snippets.

@bulfaitelo
Last active May 3, 2017 12:56
Show Gist options
  • Save bulfaitelo/64bcfde04483c8e80e726579a714fb8e to your computer and use it in GitHub Desktop.
Save bulfaitelo/64bcfde04483c8e80e726579a714fb8e to your computer and use it in GitHub Desktop.
Tutorial Laravel para iniciantes - Parte 08 [Entendendo view com @extends, @yield e @section]
<!-- Stored in resources/views/layouts/app.blade.php -->
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
<body>
@section('menu')
This is the master sidebar.
@endsection
<div class="container">
@yield('content')
</div>
</body>
</html>
<!-- Stored in resources/views/child.blade.php -->
@extends('layouts.app')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection
<?php
Route::get('blade', function () {
return view('child');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment