1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| <html> <head> <title>App Name - @yield('title')</title> @hasSection('title') @yield('title') - Site Name @else Site Name @endif @stack('css') </head> <body> @section('sidebar') This is the master sidebar. @show <div class="container"> @yield('content') </div> </body> </html>
// home.blade.php @inject('userService', 'App\Services\UserService') // 服务注入 {{ $userService->getUsername() }}
@extends('layout')
@section('title', 'Page Title')
@section('sidebar') @parent <p>This is appended to the master sidebar.</p> @endsection @push('css') @endpush @section('content') <h1>Home Page</h1> @include('child') @include('child', ['data' => []]) @endsection
|