简体   繁体   中英

Laravel Blade Not Rendering/ Layout Not Working

So I created a custom layout for my design, it works on other blade but not for this one blade. I did some recheck just to make sure that it is the same as other blade that works. Also the controller is prettymuch the same since it has the same function for my other blade.

My checkout.blade:

@extends('layouts.custom')
@section('content')
    <h1> Content </h1>
@endsection

My custom layout

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        @yield('content')
    </body>
    <footer>
    </footer>
</html>

My Controller:

public function checkout()
    {
        $keranjangItems = \Cart::session(auth()->id())->getContent();

        return view('keranjang.checkout', compact('keranjangItems'));
    }

And I've tried to put the content on other blade and got no problem. And I've tried to change my other controller to view this blade and also working. Can anyone help me find where the problem is? thanks
Update: I also tried to just put together the code no include layout or what so ever and it's still have the same result

On your custom.blade file it says

@yield('layouts.header')

and on your checkout.blade file it says

@section('content')
    <h1> Content </h1>
@endsection

Either update the layout to match the section name on your checkout view or update the checkout view to match the yielded section name on the layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM