1. Xác định bố cục (Defining layout) (ok)
C:\xampp\htdocs\book\routes\web.php
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('layouts.app');
});
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
resources\views\app.blade.php
<html>
<head>
<title>Laravel</title>
</head>
<body>
@section('sidebar')
<h1>Sidebar</h1>
@show
@yield('content')
</body>
</html>
@section
: dùng để xác định một phần nội dung@yield
: dùng để hiển thị nội dung của một phần đã được xác định
Last updated
Was this helpful?