Installation:
composer require appdezign/lara-pro-base-theme
php artisan vendor:publish --tag=lara-pro-base-theme-config
php artisan vendor:publish --tag=lara-pro-base-theme-assets
php artisan vendor:publish --tag=lara-pro-base-theme-views
Configuration:
config/theme.php with your site name, logo, and other global settings.First Page Creation:
Page model record via Tinker:
php artisan tinker
>>> $page = \App\Models\Page::create([
... 'title' => 'Home',
... 'slug' => 'home',
... 'template' => 'default',
... 'content' => '<h1>Welcome to our site!</h1>'
... ]);
Routing:
Route::middleware(['web', 'theme'])->group(function () {
Route::get('/', [\Appdezign\LaraProBaseTheme\Http\Controllers\PageController::class, 'show']);
});
View Rendering:
@extends('lara-pro-base-theme::layouts.master')
@section('content')
@include('lara-pro-base-theme::pages.default', ['page' => $page])
@endsection
config/theme.php: Global theme settings.resources/views/vendor/lara-pro-base-theme/: Override or extend theme views.public/vendor/lara-pro-base-theme/: Theme assets (CSS/JS).app/Providers/ThemeServiceProvider.php for bindings and extensions.Page record for your homepage (e.g., slug home).resources/views/vendor/lara-pro-base-theme/pages/default.blade.php) to add custom sections.PageController:
Route::get('/', [\Appdezign\LaraProBaseTheme\Http\Controllers\PageController::class, 'show'])->name('home');
/ to see your homepage rendered with the theme.Pattern: Use the theme’s Blade template hierarchy to extend or replace sections.
resources/views/vendor/lara-pro-base-theme/layouts/master.blade.phpresources/views/vendor/lara-pro-base-theme/pages/{template}.blade.phpresources/views/vendor/lara-pro-base-theme/partials/{partial}.blade.phpExample: Override the header partial:
<!-- resources/views/vendor/lara-pro-base-theme/partials/header.blade.php -->
@extends('lara-pro-base-theme::partials.header')
@section('header')
<div class="custom-header">
@include('lara-pro-base-theme::partials.header.default')
</div>
@endsection
ContentBlock model to create reusable components.
@foreach($page->contentBlocks as $block)
@include('lara-pro-base-theme::blocks.'.$block->type, ['block' => $block])
@endforeach
// webpack.mix.js
mix.postCss('resources/css/app.css', 'public/css', [
require('tailwindcss'),
]);
mix.sass('resources/scss/lara-pro-base-theme.scss', 'public/css');
@livewire('theme-component')
// app/Filament/Resources/PageResource.php
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('title')->required(),
Select::make('template')->options(['default', 'blog', 'custom']),
// ...
]);
}
app/Http/Kernel.php:
protected $routeMiddleware = [
'theme' => \Appdezign\LaraProBaseTheme\Http\Middleware\ThemeMiddleware::class,
];
Route::get('/{slug}', [PageController::class, 'show'])
->name('page.show')
->middleware(['web', 'theme']);
@livewire('theme-hero-section', ['page' => $page])
Filament::serving(function () {
ThemeServiceProvider::make();
});
use Appdezign\LaraProBaseTheme\Models\Page;
Page::addGlobalScope(new \Laravel\Scout\Builder);
// config/cache.php
'default' => env('CACHE_DRIVER', 'file'),
mix.purgeCss('public/css/app.css', {
globs: [
'resources/css/**/*.css',
'resources/views/**/*.blade.php',
],
});
// app/Models/ContentBlockType.php
public static function boot()
{
parent::boot();
static::created(function ($block) {
if ($block->type === 'custom') {
// Handle custom logic
}
});
}
// app/Providers/EventServiceProvider.php
protected $listen = [
\Appdezign\LaraProBaseTheme\Events\PageRendering::class => [
\App\Listeners\LogPageRender::class,
],
];
Template Override Conflicts:
@extends and @section carefully. Document overrides in a README.md:
# Template Overrides
- `resources/views/vendor/lara-pro-base-theme/layouts/master.blade.php` (custom header/footer)
- `resources/views/vendor/lara-pro-base-theme/pages/blog.blade.php` (blog-specific layout)
Asset Naming Collisions:
app.css vs. lara-pro-base-theme.css).// webpack.mix.js
mix.sass('resources/scss/app.scss', 'public/css')
.sass('resources/scss/lara-pro-base-theme.scss', 'public/css/theme.css');
Database Schema Mismatches:
pages, content_blocks).php artisan migrate --path=/vendor/appdezign/lara-pro-base-theme/database/migrations
Or manually adjust your migrations to match the theme’s schema.Filament Version Conflicts:
composer.json:
"filament/filament": "^5.0"
Livewire/Alpine.js Conflicts:
How can I help you explore Laravel packages today?