Laravel @允许在主页上工作,但不能在使用相同布局的其他页面上工作

Laravel @允许在主页上工作,但不能在使用相同布局的其他页面上工作,laravel,laravel-blade,Laravel,Laravel Blade,这件事真让我抓狂。我希望有一双新的眼睛能发现我的错误 我在每一页上都有一个部分标题,但标题只显示在home.blade.php上,而不显示在其他页面上 master.blade.php <!DOCTYPE html> <html lang="{{ app()->getLocale() }}"> <head> <meta charset="utf-8" /> <

这件事真让我抓狂。我希望有一双新的眼睛能发现我的错误

我在每一页上都有一个部分标题,但标题只显示在home.blade.php上,而不显示在其他页面上

master.blade.php

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <title>@yield('title')</title>
        @stack('styles')
    </head>
    <body class="bg-light">
        <div class="container-fluid h-100">
            @yield('app')
        </div>
        @include('sweetalert::alert')
        {{ Session::forget('alert') }}
        @stack('scripts')
    </body>
</html>
@extends('layout.master')

@prepend('styles')
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <link rel="stylesheet" type="text/css" href="{{ URL::asset('css/overrides.css') }}" />
@endprepend

@section('app')
        <div class="row">
            <div class="col-12 no-padding">
                @include('layout.includes.header')
            </div>
        </div>
        <div class="row h-100">
            <div class="col-12">
                <!-- Begin nav/content row --> 
                <div class="row h-100">
                    <div id="sidebar-wrapper" class="visible">
                        @include('layout.includes.nav')
                    </div>
                    <!-- Begin main column -->
                    <div class="col content" style="overflow-x:auto;">
                        @if (Request::path() === '/')
                        <div class="row no-padding">
                            <div class="col d-none d-sm-block">
                                <h4>@yield('content-heading')</h4> <!-- [my @yield directive is here] -->
                            </div>
                            <div class="col flex-grow-1">
                                @include('layout.includes.searchform')
                            </div>
                        </div>
                        @endif
                        <div class="row no-padding inner-box shadow p-3 mb-5 bg-white rounded">
                            @yield('content')
                        </div>
                    </div>
                    <!-- END main column-->
                </div>
                <!-- END nav/content row-->
            </div>
        </div>
@endsection

@prepend('scripts')
    @include('layout.js.footer-js')
    @yield('form-js')
@endprepend
@extends('layout.app')

@section('title', 'Asset Management')

@section('content-heading', 'View All Assets') //This works

@section('content')

                            <div class="table-responsive">
                                <table class="table table-striped text-nowrap">
                                <caption>Recently Added Assets</caption>
                                    <thead>
                                        <tr>
                                            <th scope="col">Tag #</th>
                                            <th scope="col">Type</th>
                                            <th scope="col">Device</th>
                                            <th scope="col">Serial #</th>
                                            <th scope="col">Assigned</th>
                                            <th scope="col">To</th>
                                            <th scope="col">Status</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                @foreach ($assets as $asset)
                                        <tr>
                                            <td>{{ $asset->asset_tag }}</td>
                                            <td>{{ $asset->cat_name }}</td>
                                            <td>{{ $asset->man_name }} {{ $asset->model_name  }}</td>
                                            <td>{{ $asset->serial  }}</span></td>
                                            <td>{{ \Carbon\Carbon::parse($asset->assign_date)->format('D M d, Y g:iA')  }}</td>
                                            <td>{{ $asset->name  }}</td>
                                            <td>{{ $asset->status }}</td>
                                        </tr>
                                @endforeach
                                    </tbody>
                                </table>
                            </div>

@endsection

@section('form-js')
    
@endsection

@push('scripts')

@endpush

为什么
@yield('content-heading')
仅在home.blade.php上工作?

显示
@yield('content-heading')
的代码包装在:

@if (Request::path() === '/')
...
@endif
这将显示限制为仅显示该url


:)

尝试分别使用artisan命令
config:cache
cache:clear
config:clear
view:clear
进行清除,并检查其是否有效。@GhanuBha执行了
php artisan优化:clear
,问题仍在发生。谢谢!这让我快发疯了!
@if (Request::path() === '/')
...
@endif