Top

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()=='admin.rtl_layout' ) dir="rtl" @endif>

  <head>
    @include('layouts.simple.head')
    @include('layouts.simple.css')
  </head>

  @switch(Route::currentRouteName())
  @case('admin.box_layout')

  <body class="box-layout">
    @break

    @case('admin.rtl_layout')

    <body class="rtl">
      @break

      @case('admin.dark_layout')

      <body class="dark-only">
        @break

        @default

        <body>
          @endswitch
          <!-- Loader starts-->
          <div class="loader-wrapper">
            <div class="loader"></div>
          </div>
          <!-- Loader ends-->
          <!-- tap on top starts-->
          <div class="tap-top"><i data-feather="chevrons-up"></i></div>
          <!-- tap on tap ends-->
          <!-- page-wrapper Start-->
          @switch(Route::currentRouteName())
          @case('admin.image_cropper')
          <div class="page-wrapper compact-sidebar compact-small material-icon" id="pageWrapper">
            @break

            @default
            <div class="page-wrapper" id="pageWrapper">
              @endswitch
              @include('layouts.simple.header')
              <!-- Page Body Start-->
              <div class="page-body-wrapper">
                @include('layouts.simple.sidebar')
                @switch(Route::currentRouteName())
                @case('admin.checkout')
                <div class="page-body checkout">
                  @break
                  @default
                  <div class="page-body">
                    @endswitch
                    @yield('main_content')
                  </div>
                  @include('layouts.simple.footer')
                </div>
              </div>
              @include('layouts.simple.script')
              @include('admin.inc.alerts')

        </body>

</html>