1. Reference URL: https://learnku.com/docs/laravel/6.x/blade/5147#20f1dd . Blade Templates – Components & Slots
2. First, let’s write a reusable “alert” component that we want to reuse throughout the application. Create a new file: /resources/views/alert.blade.php
PHP
<!-- /resources/views/alert.blade.php -->
<div class="alert alert-danger">
<div class="alert-title">{{ $title }}</div>
{{ $slot }}
</div>3. Configure the route in /routes/web.php
PHP
Route::get('component', function () {
return view('component');
});
4. Create a new template file: /resources/views/component.blade.php
PHP
@component('alert')
@slot('title')
Forbidden
@endslot
You are not allowed to access this resource!
@endcomponent
5. Open the URL: view-source:http://laravel-theme-demo.local/component . View the source code. It matches expectations. See Figure 1

HTML
<!-- /resources/views/alert.blade.php -->
<div class="alert alert-danger">
<div class="alert-title">Forbidden</div>
You are not allowed to access this resource!
</div>