takielias / tablar-crud-generator
Laravel Tablar Crud Generator based on https://github.com/takielias/tablar
Package info
github.com/takielias/tablar-crud-generator
pkg:composer/takielias/tablar-crud-generator
Requires
- illuminate/support: >=10.0
- rdx/laravelcollective-html: ^6.6
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^11.0
README
Pairs with Laravel Tablar Admin Dashboard
Scaffolds a complete CRUD set (Model, Controller, Views, Route) for an EXISTING database table via one artisan command. Built for projects already running takielias/tablar (Tabler-based admin layout) and pairs naturally with takielias/tablar-kit and takielias/lab.
Inspired by ibex/crud-generator.
Features
- Cross-database — works on SQLite, MySQL/MariaDB, PostgreSQL, SQL Server via Laravel's driver-agnostic Schema API. Test suite passes on all three drivers in CI.
- Generates a Model with Eloquent relations,
$fillable, validation$rules, and optionalSoftDeletes. - Generates a resource Controller with all 7 CRUD actions.
- Generates Bootstrap 5 / Tabler-styled views (
index,create,edit,show,form,form-field,view-field). - Appends a
Route::resource(...)entry toroutes/web.php. - Submit buttons use takielias/lab's
ajax-submit-buttonclass for native fetch + spinner UX out of the box. - Tabler icon classes (
<i class="ti ti-...">) match the published tablar layout idiom. - AI-friendly: ships Laravel Boost guidelines + skills under
resources/boost/for in-editor agent help.
Requirements
| Component | Minimum |
|---|---|
| PHP | 8.2 |
| Laravel | 10.32+ / 11.x / 12.x / 13.x (uses Schema::getColumns/getIndexes/getForeignKeys) |
| Tablar | takielias/tablar (recommended for the published tablar::page layout) |
Installation
composer require takielias/tablar-crud-generator --dev
Service provider auto-discovered via extra.laravel.providers.
Optional: publish the config (only needed if you want to customize stub paths or naming):
php artisan vendor:publish --tag=crud
Usage
The generator reads the live database schema to infer field types — so the table must already exist before running:
# 1. Create + edit the migration php artisan make:migration create_products_table # 2. Run migration (table must exist before make:crud) php artisan migrate # 3. Scaffold CRUD php artisan make:crud products
The argument is the DB table name (plural, snake_case). Class names + view paths are inferred via Str::studly(Str::singular($table)).
Options
make:crud {name}
{--route= : Custom route name}
{--crud-name= : Custom crud name}
{--lang= : pluralizer language}
Examples:
# Custom route segment php artisan make:crud products --route=admin/products # Custom class / view path name php artisan make:crud emergencies --crud-name=Emergencies # French / Norwegian / Portuguese / Spanish / Turkish pluralization php artisan make:crud incidencies --lang=spanish
What gets generated
| File | Notes |
|---|---|
app/Models/Product.php |
$fillable from columns, $rules from NOT NULL constraints, optional SoftDeletes if a deleted_at column exists |
app/Http/Controllers/ProductController.php |
Resource controller (index/create/store/show/edit/update/destroy) using Product::paginate(10) |
resources/views/product/index.blade.php |
Tabler list view with action dropdown |
resources/views/product/create.blade.php |
Includes form.blade.php |
resources/views/product/edit.blade.php |
Includes form.blade.php with method spoofing |
resources/views/product/show.blade.php |
Read-only detail page |
resources/views/product/form.blade.php |
Field rendering wrapper, ends with <button class="btn btn-primary ms-auto ajax-submit-button has-spinner">Submit</button> |
resources/views/product/form-field.blade.php |
Per-column form field markup |
resources/views/product/view-field.blade.php |
Per-column read-only markup |
| Route entry | Appended to routes/web.php: Route::resource('/products', App\Http\Controllers\ProductController::class); |
The generator does NOT create the migration. Define + migrate the table first.
Layout convention
Generated views follow tablar's published layout idiom:
@extends('tablar::page') @section('title', '{{modelTitle}}') @section('content') <div class="page-header d-print-none"> <div class="container-xl"> <div class="row g-2 align-items-center"> <div class="col"> <div class="page-pretitle">List</div> <h2 class="page-title">{{ __('{{modelTitle}}') }}</h2> </div> <div class="col-12 col-md-auto ms-auto d-print-none"> <div class="btn-list"> <a href="..." class="btn btn-primary"><i class="ti ti-plus me-1"></i> Create</a> </div> </div> </div> </div> </div> <div class="page-body"> <div class="container-xl"> <div class="card">...</div> </div> </div> @endsection
Override crud.layout in config/crud.php to extend a different master layout.
Regeneration safety
The generator overwrites without prompting and appends Route::resource(...) on every run (no idempotency check). Workflow when re-scaffolding:
git add -A && git commit -m "wip: pre-regenerate" sed -i '/Route::resource.*ProductController::class/d' routes/web.php php artisan make:crud products
Database support
| Driver | Status |
|---|---|
| SQLite | ✅ tested |
| MySQL / MariaDB | ✅ tested |
| PostgreSQL | ✅ tested |
| SQL Server | ✅ supported (same Schema API surface) |
Schema introspection uses Schema::getColumns(), Schema::getIndexes(), and Schema::getForeignKeys() — driver-agnostic since Laravel 10.32.
AI guidelines (Laravel Boost)
This package ships Boost-compatible guidelines + skills under resources/boost/. Consumer apps with laravel/boost installed get them automatically:
composer require laravel/boost --dev
php artisan boost:install # opt into "skills" feature; select takielias/tablar-crud-generator
Once published, your AI agent (Claude Code, Cursor, Copilot, etc.) can use the tablar-crud-generator-development skill to answer questions about flag semantics, generated file shapes, and stub customization without reading source.
Example
Contact
Taki Elias — @takiele — ebuz.xyz — taki.elias@gmail.com

