Prerequisites:
Install the Demo Theme:
composer require appdezign/lara-demo-theme
php artisan vendor:publish --tag=lara-demo-theme-assets
Configure Lara CMS:
config/lara-cms.php to include the demo theme in the themes array:
'themes' => [
'demo' => [
'name' => 'Demo Theme',
'path' => base_path('vendor/appdezign/lara-demo-theme'),
'is_child' => true,
'parent' => 'base', // Assumes 'base' theme exists
],
],
First Use Case:
/admin).home.blade.php)./demo-theme (or your configured route).Key Files to Inspect:
resources/views/ – Blade templates for pages/components.config/demo-theme.php – Theme-specific settings (if published).routes/web.php – Theme routes (may override Lara CMS defaults).vendor/appdezign/lara-demo-theme/resources/views/ to your project’s resources/views/ (e.g., resources/views/partials/header.blade.php).@extends in Blade: Leverage the parent theme’s layouts:
@extends('demo-theme::layouts.app')
@section('content')
{{ $slot }}
@endsection
config/lara-cms.php:
'active_theme' => env('THEME', 'demo'),
@foreach($page->blocks as $block)
@includeIf("demo-theme::blocks.{$block->type}", ['block' => $block])
@endforeach
AppServiceProvider:
public function boot()
{
LaraCms::blocks()->register('custom_block', \App\Blocks\CustomBlock::class);
}
routes/web.php:
Route::prefix('demo')->group(function () {
Route::get('/', [\Appdezign\DemoTheme\Http\Controllers\PageController::class, 'home']);
});
namespace App\Http\Controllers;
use Appdezign\DemoTheme\Http\Controllers\DemoThemeController;
class CustomDemoController extends DemoThemeController
{
public function customPage() { ... }
}
php artisan vendor:publish --tag=lara-demo-theme-assets --force
// resources/js/demo-theme.js
require('./demo-theme');
// webpack.mix.js
mix.js('resources/js/demo-theme.js', 'public/js')
.postCss('resources/css/demo-theme.css', 'public/css', []);
resources/lang/:
// resources/lang/en/demo-theme.php
return [
'welcome' => 'Welcome to our Demo Theme!',
];
@lang('demo-theme::key', 'fallback') in Blade.composer create-project appdezign/lara-demo-theme my-demo-site
php artisan laracms:seed --theme=demo
?preview=true) to test changes without caching issues.resources/themes/demo and update config/lara-cms.php:
'themes' => [
'demo' => [
'path' => resource_path('themes/demo'),
],
],
vendor/appdezign/lara-demo-theme/resources/views/ to resources/themes/demo/views/.AppServiceProvider.// config/lara-cms.php
'active_theme' => env('THEME', 'demo'),
THEME=demo in .env for development, THEME=custom for production.use Laravel\Scout\Searchable;
class Page extends Model implements Searchable { ... }
// tailwind.config.js
module.exports = {
presets: [require('appdezign/lara-demo-theme/tailwind.config')],
theme: {
extend: {
colors: {
primary: '#10B981', // Override demo theme colors
},
},
},
};
<button x-on:click="toggleMobileMenu()" class="mobile-menu-button">
Menu
</button>
use Spatie\MediaLibrary\HasMedia;
class Page extends Model implements HasMedia { ... }
LaraCms::fields()->register('rich_text', \App\Fields\RichTextField::class);
Route::middleware('auth:sanctum')->get('/api/pages', [PageController::class, 'index']);
<div x-data="{ page: @entangle('page') }">
{{ $page->title }}
</div>
php artisan vendor:publish --tag=lara-demo-theme-assets --force
Route::prefix('demo')->middleware(['web', 'demo-theme'])->group(...);
php artisan view:clear
php artisan route:clear
php artisan cache:clear
?preview=true in development to bypass caching.app/ moved to app/ root) may break paths.
composer.json aliases and Blade @include paths:
@include('demo-theme::partials.header') // Use vendor path
How can I help you explore Laravel packages today?