How can I overcome Laravel 8 template system problem

289 views Asked by At

In layout folder I have a file named "app.blade.php". To render some content from other balde file I wrote in the file @yield('content')

I created another file in "views/admin" name "dashboard.blade.php". Written code in this file is

@extends('home')
@section('content')
    Test text
@endsection

But content doesn't load in "app.blade.php" file thus nothing in

@yield('content') section

What to do?

2

There are 2 answers

1
Kamlesh Paul On

update this

@extends('layouts.app')  <---------- it will extend app.blade.php  then inside that section will render content
@section('content')
    Test text
@endsection

ref link https://laravel.com/docs/8.x/blade#extending-a-layout

2
Ashiful Islam Prince On

Error Identified and solved

You said that content does not load in app.blade.php but you have extends the home page.

Update your script like this->

@extends('layouts.app')
@section('content')
Test text
@endsection

I think you got where you made the wrong. Let me know about the updates