Directory Structure
Understanding the file layout is the first step to building a theme.
Where Theme Files Live
lara-app/
├── resources/
│ └── views/
│ ├── layout/ ← Master layout & partials (YOUR THEME)
│ │ ├── layout.blade.php ← Required: the outermost HTML shell
│ │ ├── header.blade.php
│ │ └── footer.blade.php
│ ├── template/ ← Page-specific templates (YOUR THEME)
│ │ ├── home.blade.php
│ │ ├── product_details.blade.php
│ │ ├── productlist.blade.php
│ │ └── sms_index.blade.php
│ └── partial/ ← Reusable sub-components (YOUR THEME)
│ ├── homepageproduct.blade.php
│ ├── productslider.blade.php
│ ├── productdetaildiv.blade.php
│ └── paginator.blade.php
│
├── Modules/
│ └── Application/
│ └── resources/
│ └── views/
│ ├── layouts/
│ │ └── app.blade.php ← Module layout (auth pages only)
│ ├── user/
│ │ ├── login.blade.php
│ │ ├── register.blade.php
│ │ ├── forgot.blade.php
│ │ ├── myaccount.blade.php
│ │ └── ...
│ └── ...
│
└── app/
└── Support/
└── theme_helpers.php ← All global theme helper functions (READ-ONLY)
Key Directories Explained
resources/views/layout/
This is where your master layout lives. The layout.blade.php file is the HTML shell that wraps every page. All page templates call @extends('layout.layout') to use it.
This directory typically also contains header and footer partials that are @included inside layout.blade.php.
resources/views/template/
Page-specific templates. Each unique page type has a file here:
- home.blade.php — the homepage
- product_details.blade.php — single product page
- productlist.blade.php — category/product listing page
resources/views/partial/
Small, reusable components. They are @included into both layout and template files. Common examples:
- homepageproduct.blade.php — product card used in homepage grids
- productslider.blade.php — image gallery for product detail
- paginator.blade.php — pagination controls
Modules/Application/resources/views/user/
User account pages (login, register, my account, etc.) live here as module views. They @extend('layout.layout') just like regular templates, so they automatically pick up your theme's header and footer.
Asset Files
Theme static assets (CSS, JS, images) are served from the public assets directory. Use the theme_asset() helper to reference them:
public/
└── files/
└── s{site_id}/
└── templates/
└── {theme_name}/
├── css/
│ └── style.css
├── js/
│ └── app.js
└── images/
└── ...
{{-- Reference theme assets --}}
<link rel="stylesheet" href="{{ theme_asset('css/style.css') }}">
<script src="{{ theme_asset('js/app.js') }}"></script>
Template Resolution Order
When the application renders a page, it looks for templates in this order:
- Module views (for module-owned pages like login/register)
resources/views/template/(for theme-owned pages like home/product)- Fallback to a default error view if no template is found
The layout.layout view always refers to resources/views/layout/layout.blade.php.