问题
I was already trying to follow the documentation tutorial. But, I always get an error, and I don't know how to solve it
How can I include a blade template in a different directory?
Dashboard.blade.php = in folder views/admin Landingpage.blade.php = in folder views/admin/subpage
回答1:
The @include
directive allows you to include a Blade view from within another view.
//resources/views/admin/dashboard.blade.php
@include('admin.dashboard')
//resources/views/admin/subpage/landingpage.blade.php
@include('admin.subpage.landingpage')
You can also pass data into the included views.
@include('admin.dashboard', ['user' => $user])
来源:https://stackoverflow.com/questions/55998128/how-to-include-a-blade-template-in-different-directory