Laravel Include a Blade File | Include a Sub-view

Here we will learn how to include a blade file or subview in laravel. It's actually relatively easy. Just use the include directive to include it.

But you must make sure that you have the correct path inside include directive.

For example I created a new view inside resources/views/frontend/ folder. Here the last folder is frontend. So inside include directive you must mention frontend and then you must add a dot and then write the blade file name.

So finally it would look this

@include('frontend.ads')

Here ads is the blade file name.

Now, that's how you include a view or a sub-view within other views.

Now say, I wanna access this ads view in another folder under resources/views/courses. Inside courses folder I have intro_courses.blade.php file. 

So here inside intro_courses.blade.php file I would write like below

@include('frontend.ads')