appdezign/lara-base-theme
Base theme for Lara CMS 8, a flexible Laravel-based CMS by Firmaq Media. Provides the default foundation for building Lara CMS sites and custom themes. Full developer documentation available at https://docs.laracms.nl/
Install Lara CMS Core Ensure you have a Laravel 11+ project with Lara CMS installed (follow official docs).
composer require appdezign/lara-cms
Publish the Base Theme Publish the base theme assets and configurations:
php artisan vendor:publish --provider="Appdezign\LaraCms\Providers\ThemeServiceProvider" --tag="base-theme"
This generates:
resources/views/vendor/lara-base-theme/ (Blade templates)config/lara-cms.php (theme-related settings)Register the Theme
Add the base theme to your config/lara-cms.php under themes:
'themes' => [
'base' => [
'name' => 'Base Theme',
'path' => 'vendor/appdezign/lara-base-theme',
'active' => true,
],
],
First Use Case: Render a CMS Page
Create a route in routes/web.php:
use Appdezign\LaraCms\Facades\Page;
Route::get('/blog/{slug}', function ($slug) {
$page = Page::findBySlug($slug);
return view('vendor.lara-base-theme::pages.show', compact('page'));
});
Override the default template in resources/views/vendor/lara-base-theme/pages/show.blade.php.
vendor/appdezign/lara-base-theme/resources/views/ for Blade layouts and partials.config/lara-cms.php for theme-specific settings (e.g., active_theme, default_layout).Appdezign\LaraCms\Providers\ThemeServiceProvider for registration logic.Customize the Layout:
vendor/appdezign/lara-base-theme/resources/views/layouts/app.blade.php to resources/views/vendor/lara-base-theme/layouts/app.blade.php./home).resources/views/vendor/lara-base-theme/ folder.cp vendor/appdezign/lara-base-theme/resources/views/pages/show.blade.php resources/views/vendor/lara-base-theme/pages/
Customize the copied file (e.g., add a sidebar or modify the title tag).Page facade to fetch and render content dynamically.// In a controller or Blade view
use Appdezign\LaraCms\Facades\Page;
$page = Page::findBySlug('about-us');
return view('vendor.lara-base-theme::pages.show', compact('page'));
@foreach($page->content as $block)
@include('vendor.lara-base-theme::blocks.'.$block->type, ['block' => $block])
@endforeach
php artisan vendor:publish --tag="base-theme-assets"
webpack.mix.js to include theme-specific files:
mix.copy('vendor/appdezign/lara-base-theme/resources/assets', 'public/vendor/lara-base-theme');
// app/Providers/ThemeExtensionsServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class ThemeExtensionsServiceProvider extends ServiceProvider
{
public function register()
{
// Bind custom theme logic
$this->app->singleton('custom.theme.helper', function () {
return new \App\Services\CustomThemeHelper();
});
}
}
Register the provider in config/app.php.// routes/web.php
Route::middleware(['auth', 'cms.theme'])->group(function () {
Route::get('/admin/theme', [ThemeController::class, 'dashboard']);
});
auth()->check()) alongside CMS-specific checks.Validator::extend()).PageCreated) via Laravel’s event system:
Event::listen(PageCreated::class, function ($page) {
// Custom logic after page creation
});
// webpack.mix.js
mix.postCss('resources/css/app.css', 'public/css', [
require('tailwindcss'),
]);
return Inertia::render('Pages/Show', ['page' => $page]);
App\Models\ExtendedPage) if additional fields are needed.
class ExtendedPage extends \Appdezign\LaraCms\Models\Page
{
protected $casts = [
'custom_field' => 'array',
];
}
.env to switch themes or configurations:
THEME_ACTIVE=custom
Access in Blade:
@if(config('lara-cms.theme.active') === 'custom')
{{-- Custom theme logic --}}
@endif
Vendor Directory Overrides
vendor/ to resources/views/vendor/ before modifying them, leading to lost changes on package updates.cp -r vendor/appdezign/lara-base-theme/resources/views/* resources/views/vendor/lara-base-theme/
Lara CMS Dependency
Page, Media) exist in your database. Install Lara CMS core if missing:
composer require appdezign/lara-cms
php artisan lara-cms:install
Asset Pipeline Conflicts
/* Theme-specific styles */
.lara-base-theme-header { ... }
Caching Headaches
php artisan view:clear
php artisan cache:clear
php artisan config:clear
Route Conflicts
Route::prefix('cms')->middleware(['web', 'cms'])->group(function () {
// Lara CMS routes
});
Database Schema Mismatches
pages, media) that don’t exist.php artisan migrate --path=vendor/appdezign/lara-cms/database/migrations
Laravel Version Mismatches
composer.json for Laravel requirements and update your project accordingly.How can I help you explore Laravel packages today?