Home > Mobile >  Laravel yield is empty
Laravel yield is empty

Time:06-19

I have a master blade file that includes some other blade files and yields content of a blade file called home which I extend on this master blade, I can click on master from my home blade in phpstorm and it takes me to the correct file, so they must be connected correctly.

The problem is the contents are not loaded, it just loads the head/header and footer but nothing from my home.blade.

My master.blade.php:

<!doctype html>
<html lang="en">
@include('partials.head')
<body>

@include('partials.header')
@yield('content')
@include('partials.footer')
</body>
</html>

In my home.blade.php

@extends('master')
@section('title', 'Home')
@section('content')
<main id="content">
    test
</main>
@endsection

It loads everything correctly except the content section. What am I doing wrong?

Only route I got:

Route::get('/', function () {
    return view('master');
});

CodePudding user response:

You have to change the view of the route,

Route::get('/', function () {
    return view('home');
});
  • Related