Q:

How to call ...blade.php in different folder inside views folder in laravel

Excuse me, i would like to ask about how to call another page blade in different subfolder inside views.
Example :
views
   --home(subfolder)
   --beranda(subfolder)
       --refresh.blade.php
   --layouts(subfolder)
       --master.blade.php

in master.blade.php implements template page, when i click one link in this folder may have to go in refresh.blade.php.
Likely another web layout, they have a lot of link in header like 'Home', 'Paper', etc.
I'm still learned more about laravel as beginner practice.
May you can help me, i'll appreciate that.
Regard, Aga.

A:

I think you can refer to some directives such as @include and @extends in the laravel blade.
For example, in the admin.common.header view (located at admin/common/header.blade.php), we have some basic page code (common to various pages such as navigation bar or layout). We use @yield such as @yield ("extra_js") or @yield ("extra_css") where we want to add code later.
header.blade.php
<html>
    <head>
        something maybe ...
        @yield("extra_css")
    </head>
    <body>
        something maybe ...
        @yield("extra_js")
    </body>
</html>

And in another view such as admin.feedback.feedback, you can use @extends('admin.common.header') at the top of the code to inheritance the template and you will get the layout of this template.
For different content in the feedback template, you can use @section to give you code to fill in the inheritance template such as @section('extra_js').
feedback.blade.php
@extends('admin.common.header')
@section('extra_js')
<script> something... </script>
@endsection

If you want to include one blade, just use @include.
<div>
    @include('shared.errors')

    <form>
        <!-- Form Contents -->
    </form>
</div>

In laravel blade there are many instructions to complete the rendering of the template, if you want to know clearly, please refer to the corresponding version of the official document.

