Laravel CMS for starters.
A beginner-friendly content management system built with Laravel 13, Filament 5, DaisyUI 5, and Lucide Icons. Designed as a learning resource and starter template for those new to Laravel or Filament. Works great with AI coding assistants like Claude Code.
Homepage
Admin Panel
git clone https://github.com/ozdemirburak/simple-cms.git
cd simple-cmscomposer installnpm installNote: This project ships an
.npmrcwithignore-scripts=trueto mitigate npm supply chain attacks.
cp .env.example .env
php artisan key:generateThe default configuration uses SQLite. The database file will be created automatically.
php artisan migrateOption A: Admin user only (minimal setup)
php artisan db:seedThis creates:
Admin user:
[email protected]passwordEditor user:
[email protected]passwordOption B: Admin user + Sample content
php artisan db:seed
php artisan db:seed --class=ContentSeederThis adds sample categories, articles, and pages (Privacy Policy, Terms of Service, About, Contact).
Create the symbolic link for public storage (required for image uploads):
php artisan storage:linknpm run devFor production:
npm run buildphp artisan serveOr use Laravel Valet/Herd for a custom domain like cms.test.
Access the admin panel at /admin:
Admin login (full access):
Editor login (no user management):
Categories organize your articles by topic. Each category has:
Articles are the main content type. Each article has:
Static pages for content like About, Contact, Privacy Policy, etc. Each page has:
The CMS supports two user roles:
Content ownership is tracked via user_id on articles, pages, and media. The OwnerablePolicy and the shared BelongsToOwner trait (which adds a visibleTo() query scope to Article, Page, Media, and MediaItem) keep authorization and listing in sync — both follow the same own-or-orphan rule. Deleting a user preserves their content (ownership is set to null via nullOnDelete), and other editors can then take over those records (forceDelete stays admin-only).
The admin dashboard includes:
All four widgets respect ownership scoping: editors see their own content (plus orphans), admins see everything. The "Total Users" stat is admin-only. Stats are cached per user for 60 seconds and invalidated automatically on relevant content changes or role updates.
The Media Library allows you to:
Images are stored in storage/app/public/ and managed by Spatie Media Library with Filament's plugin.
| Route | Description |
|---|---|
/ |
Home page with featured and latest articles |
/articles |
All articles listing with category filters |
/article/{slug} |
Individual article page |
/category/{slug} |
Articles filtered by category |
/page/{slug} |
Static page |
This guide shows how to add a new resource (e.g., "Product") to the CMS.
php artisan make:model Product -mEdit the migration file in database/migrations/:
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->text('description')->nullable();
$table->decimal('price', 10, 2);
$table->boolean('is_active')->default(true);
$table->timestamps();
});Edit the model in app/Models/Product.php:
'boolean',
'price' => 'decimal:2',
];
// Auto-generate slug from title
protected static function booted(): void
{
static::creating(function (Product $product) {
if (empty($product->slug)) {
$product->slug = Str::slug($product->title);
}
});
}
// Scope for active products
public function scopeActive($query)
{
return $query->where('is_active', true);
}
}Run the migration:
php artisan migrateCreate the resource directory structure:
app/Filament/Resources/Products/
├── ProductResource.php
├── Pages/
│ ├── CreateProduct.php
│ ├── EditProduct.php
│ └── ListProducts.php
├── Schemas/
│ └── ProductForm.php
└── Tables/
└── ProductsTable.phpProductResource.php:
ListProducts::route('/'),
'create' => CreateProduct::route('/create'),
'edit' => EditProduct::route('/{record}/edit'),
];
}
}Schemas/ProductForm.php:
…Tables/ProductsTable.php:
columns([
TextColumn::make('title')->searchable()->sortable(),
TextColumn::make('price')->money('USD')->sortable(),
IconColumn::make('is_active')->boolean(),
TextColumn::make('created_at')->dateTime()->sortable(),
])
->defaultSort('created_at', 'desc');
}
}Pages/ListProducts.php, CreateProduct.php, EditProduct.php:
// ListProducts.php
latest()->paginate(12);
return view('frontend.products.index', compact('products'));
}
public function show(string $slug)
{
$product = Product::active()->where('slug', $slug)->firstOrFail();
return view('frontend.products.show', compact('product'));
}
}routes/web.php - Add routes:
use App\Http\Controllers\Frontend\ProductController;
Route::get('/products', [ProductController::class, 'index'])->name('products.index');
Route::get('/product/{slug}', [ProductController::class, 'show'])->name('products.show');resources/views/frontend/products/index.blade.php:
Products
@endforeach
{{ $products->links() }}
Add to lang/en/frontend.php:
'products' => [
'title' => 'Products',
'no_products' => 'No products found.',
],Component Namespaces:
// Layout components - use Schemas\Components
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Tabs;
// Form input components - use Forms\Components
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Toggle;Property Types:
// Navigation icon uses BackedEnum
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocument;
// Navigation group uses UnitEnum
protected static string|\UnitEnum|null $navigationGroup = 'Content';Widget Properties (instance, not static):
// CORRECT - instance properties
protected ?string $heading = 'Chart Title';
protected ?string $description = 'Description';
protected int|string|array $columnSpan = 'full';
// WRONG - do NOT use static for these
// protected static ?string $heading = 'Title';The frontend uses a custom DaisyUI theme called "editorial". You can modify it in resources/css/app.css:
@plugin "daisyui/theme" {
name: "editorial";
default: true;
color-scheme: light;
--color-primary: oklch(45% 0.15 25);
/* ... other colors */
}The frontend uses Blade Lucide Icons for consistent iconography:
Browse available icons at lucide.dev.
The default favicon is public/favicon.png (192×192), wired up in resources/views/components/layouts/app.blade.php.
For a full icon set (multiple PNG sizes, web manifest), generate one at .
All frontend text uses Laravel's localization system. Strings are stored in lang/en/frontend.php.
To add a new language:
lang/fr/lang/en/frontend.php to lang/fr/frontend.phpAPP_LOCALE=fr in .env…| File | Purpose |
|---|---|
app/Models/Article.php |
Article model with published scope and view tracking |
app/Models/ArticleView.php |
Article view tracking model |
No open issues yet, or sync has not completed.