Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

croftCoder's avatar

Laravel Blade @props Not Working

trying to load blade components when @props variable is true or false but doesn't seems to be working.

app.blade.php layout file

@props([
    'has_header'  => true,
    'has_footer'  => true,
])

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <title>{{ config('app.name', 'Laravel') }}</title>
        <link rel="stylesheet" href="{{ page_asset('css/app.css') }}">
    </head>
    <body class="font-sans antialiased">
        <div id="app">
            @if ($has_header)
                <x-app::layouts.header />
            @endif

            {{ $slot }}

            @if ($has_footer)
                <x-app::layouts.footer />
            @endif
        </div>
    </body>
</html>

login.blade.php

@props([
    'has_header'  => false,
    'has_footer'  => false,
])

<x-app::layouts>
	// content
</x-app::layouts>

header and footer keeps showing on login page. is there a way to correctly implement this to have certain anonymous components load when @props is set to true or false?

0 likes
1 reply

Please or to participate in this conversation.