Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

simple-cms

> 后端框架
Open source

Laravel CMS for starters.

717 stars0 likes1 views
WebsiteGitHub

About

Laravel CMS for starters.

Simple CMS

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.

Features

  • Admin Panel - Beautiful admin interface powered by Filament 5
  • Content Management - Manage articles, categories, and pages
  • Media Library - Manage uploaded images with Spatie Media Library
  • Analytics Dashboard - Track article views with charts and statistics
  • User Roles - Admin and Editor roles with different permissions
  • Modern Frontend - Clean, editorial-style design using DaisyUI 5, Tailwind CSS 4, and Lucide Icons

Screenshots

Homepage

Admin Panel

Requirements

  • PHP 8.3+
  • Composer
  • Node.js 18+
  • npm or yarn

Installation

1. Clone the repository

bash
git clone https://github.com/ozdemirburak/simple-cms.git
cd simple-cms

2. Install PHP dependencies

bash
composer install

3. Install Node dependencies

bash
npm install

Note: This project ships an .npmrc with ignore-scripts=true to mitigate npm supply chain attacks.

4. Environment setup

bash
cp .env.example .env
php artisan key:generate

5. Database setup

The default configuration uses SQLite. The database file will be created automatically.

bash
php artisan migrate

6. Seed the database

Option A: Admin user only (minimal setup)

bash
php artisan db:seed

This creates:

Admin user:

  • Email: [email protected]
  • Password: password

Editor user:

  • Email: [email protected]
  • Password: password

Option B: Admin user + Sample content

bash
php artisan db:seed
php artisan db:seed --class=ContentSeeder

This adds sample categories, articles, and pages (Privacy Policy, Terms of Service, About, Contact).

7. Storage setup

Create the symbolic link for public storage (required for image uploads):

bash
php artisan storage:link

8. Build frontend assets

bash
npm run dev

For production:

bash
npm run build

9. Start the development server

bash
php artisan serve

Or use Laravel Valet/Herd for a custom domain like cms.test.

Usage

Admin Panel

Access the admin panel at /admin:

  • URL: http://localhost:8000/admin

Admin login (full access):

  • Email: [email protected]
  • Password: password

Editor login (no user management):

  • Email: [email protected]
  • Password: password

Content Types

Categories

Categories organize your articles by topic. Each category has:

  • Title
  • Slug (auto-generated)
  • Description
  • Active status

Articles

Articles are the main content type. Each article has:

  • Title
  • Slug (auto-generated)
  • Excerpt (optional summary)
  • Content (rich text editor)
  • Featured image
  • Category (optional)
  • Published status and date
  • View count tracking

Pages

Static pages for content like About, Contact, Privacy Policy, etc. Each page has:

  • Title
  • Slug (auto-generated)
  • Excerpt (optional summary)
  • Content (rich text editor)
  • Parent page (for hierarchical structure)
  • Sort order (for navigation)
  • Published status

User Roles

The CMS supports two user roles:

  • Admin - Full access to all features including user management. Can see and manage all content regardless of ownership
  • Editor - Can manage articles, categories, and pages (no user management). Can see and edit content they own plus orphaned content — records whose original owner was deleted, so they aren't permanently locked from anyone but admins

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).

Analytics Dashboard

The admin dashboard includes:

  • Stats Overview - Total views, articles, categories, pages, and users
  • Article Views Chart - Line chart showing daily views over 30 days
  • Top Articles - Most viewed articles table
  • Recent Articles - Latest article updates

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.

Admin Resources

  • Articles - CRUD for articles with view count display
  • Categories - CRUD for categories
  • Pages - CRUD for static pages
  • Users - User management (Admin only)
  • Media Library - Browse and upload images (powered by Spatie Media Library)
  • Article Views - Detailed view logs with filtering (under Analytics)

Media Library

The Media Library allows you to:

  • Upload multiple images at once with drag & drop
  • Reorder images before uploading
  • Edit images (crop, rotate) using the built-in image editor
  • View all uploaded images across the CMS
  • Preview images with details (size, type, URL)
  • Copy image URLs for use in content
  • Filter by collection or model type
  • Delete unused images

Images are stored in storage/app/public/ and managed by Spatie Media Library with Filament's plugin.

Frontend Routes

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

Developer Guide

Adding a New Resource (Model + Admin + Frontend)

This guide shows how to add a new resource (e.g., "Product") to the CMS.

Step 1: Create the Model and Migration

bash
php artisan make:model Product -m

Edit the migration file in database/migrations/:

php
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:

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:

bash
php artisan migrate

Step 2: Create Filament Admin Resource

Create the resource directory structure:

app/Filament/Resources/Products/
├── ProductResource.php
├── Pages/
│   ├── CreateProduct.php
│   ├── EditProduct.php
│   └── ListProducts.php
├── Schemas/
│   └── ProductForm.php
└── Tables/
    └── ProductsTable.php

ProductResource.php:

php
 ListProducts::route('/'),
            'create' => CreateProduct::route('/create'),
            'edit' => EditProduct::route('/{record}/edit'),
        ];
    }
}

Schemas/ProductForm.php:

…

Tables/ProductsTable.php:

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:

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:

php
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:

blade

    
        
Products

        

                
            @endforeach
        
        {{ $products->links() }}
    

Step 4: Add Language Strings (Optional)

Add to lang/en/frontend.php:

php
'products' => [
    'title' => 'Products',
    'no_products' => 'No products found.',
],

Filament 5 Important Notes

Component Namespaces:

php
// 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:

php
// 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):

php
// 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';

Customization

Theme

The frontend uses a custom DaisyUI theme called "editorial". You can modify it in resources/css/app.css:

css
@plugin "daisyui/theme" {
  name: "editorial";
  default: true;
  color-scheme: light;

  --color-primary: oklch(45% 0.15 25);
  /* ... other colors */
}

Icons

The frontend uses Blade Lucide Icons for consistent iconography:

blade

Browse available icons at lucide.dev.

Favicon

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 .

Internationalization

All frontend text uses Laravel's localization system. Strings are stored in lang/en/frontend.php.

To add a new language:

  1. Create a new directory: lang/fr/
  2. Copy lang/en/frontend.php to lang/fr/frontend.php
  3. Translate the strings
  4. Set APP_LOCALE=fr in .env

Project Structure

…

Key Files

File Purpose
app/Models/Article.php Article model with published scope and view tracking
app/Models/ArticleView.php Article view tracking model

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPcontent-managementcontent-management-systemfilamentlaravel

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架