Level 6
hi @ajvanho, please take a look at https://laravel.com/docs/9.x/blade#slots
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
resources/views/master.blade.php`
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<h1 class="text-3xl font-bold underline">
Hello world!
</h1>
<main>
{{ $slot }}
</main>
<!-- Scripts -->
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
</body>
</html>
master layout class component
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class MasterLayout extends Component
{
/**
* Create a new component instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('master');
}
}
resources/view/app.blade.php
<x-master-layout>
Helo from slot
</x-master-layout>
Please or to participate in this conversation.