Laravel file structure
Laravel provides web template engine for reducing the code repetition. making it more readable and easy to modify.
We have created master.blade.php which contains all the common css and javascript files and we have also included header and footer in this file as they are the same in majority of the pages.
master.blade.php
<!DOCTYPE html>
<html lang="en" @if(Route::currentRouteName()=='rtl_layout') dir="rtl" @endif>
<head>
@include('layouts.simple.head')
@include('layouts.simple.css')
</head>
@switch(Route::currentRouteName())
@case('box_layout')
<body class="box-layout">
@break
@case('rtl_layout')
<body class="rtl">
@break
@case('dark_layout')
<body class="dark-only">
@break
@default
<body>
@endswitch
<!-- loader starts-->
<div class="loader-wrapper">
<div class="theme-loader">
<div class="loader-p"></div>
</div>
</div>
<!-- loader ends-->
<!-- tap on top starts-->
<div class="tap-top"><i data-feather="arrow-up"></i></div>
<!-- tap on tap ends-->
<!-- page-wrapper Start-->
<div @if(Route::currentRouteName()=='box_layout') class="page-wrapper compact-wrapper box-layout" id="pageWrapper" @else class="page-wrapper compact-wrapper" id="pageWrapper" @endif>
<div class="page-header row">
<div class="header-logo-wrapper col-auto">
<div class="logo-wrapper">
<a href="{{ route('admin.dashboard') }}">
<img class="img-fluid for-light" src="{{ asset('assets/images/logo/logo.png') }}" alt=""/>
<img class="img-fluid for-dark" src="{{ asset('assets/images/logo/logo_light.png') }}" alt=""/>
</a>
</div>
</div>
<p class="mb-0">Here’s what’s happening with your store today.</p>
</div>
<div class="col-4 col-xl-4 page-title">
@yield('breadcrumb-title')
<nav>
<ol class="breadcrumb justify-content-sm-start align-items-center mb-0">
<li class="breadcrumb-item">
<a href="{{ route('admin.dashboard') }}">
<i data-feather="home"></i>
</a>
</li>
@yield('breadcrumb-items')
</ol>
</nav>
</div>
@include('layouts.simple.header')
</div>
<div class="page-body-wrapper">
@include('layouts.simple.sidebar')
<div @if(Route::currentRouteName()=='checkout') class="page-body checkout" @else class="page-body" @endif>
@yield('main_content')
</div>
@include('layouts.simple.footer')
</div>
@include('layouts.simple.script')
@include('admin.inc.alerts')
</body>
</html>