Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Admin Generator Laravel Package

brackets/admin-generator

Brackets Admin Generator is a Laravel package that scaffolds admin panels and CRUD screens from Eloquent models, with configurable tables, forms, filters, and authorization hooks to speed up internal tools and backend management.

View on GitHub
Deep Wiki
Context7

Getting Started

Prerequisites. This is not a standalone admin panel — it is a code generator that only produces CRUD scaffolding compatible with brackets/craftable (and its siblings brackets/admin-auth, brackets/admin-ui). You need a Laravel 8 project with Craftable already installed and its admin route file (routes/admin.php) wired up. If you just want an admin panel without Craftable, stop here.

Install.

composer require brackets/admin-generator --dev

Install it as a dev dependency — the artifact it produces is the controller/request/view code, not the generator itself. Commit composer.lock and the generated files.

First thing to look at. After install, read the generated file layout, not the package source. The generator writes to:

  • app/Http/Controllers/Admin/{Plural}Controller.php
  • app/Http/Requests/Admin/{Plural}/*
  • app/Http/Transformers/{Plural}Transformer.php (if requested)
  • resources/views/admin/{plural}/ (index, edit, create, show)
  • routes/admin.php (appends a Route::resource block)
  • resources/lang/{locale}/admin/{plural}.php
  • A permissions seeder in database/seeders/

Those paths are the contract. Everything you'll customize day to day lives there, not in vendor/.

First use case. Scaffold a CRUD for an existing posts table with sensible columns (title, body, published_at, author_id):

php artisan admin:generate Posts --table=posts

The command introspects the schema, maps column types to Craftable form components (string → text input, text → textarea, datetime → datepicker, *_id with an FK constraint → dropdown), and generates the whole slice. Run the generated permissions seeder, then log into /admin/posts.

Implementation Patterns

Generate from the table, not the other way round. The most reliable workflow is: write migrations, run them, then generate. The schema introspection is where the package earns its keep — you get field types, nullable flags, defaults, and FK relationships reflected in the views automatically. Generating from --fields before you have a table works but is fragile; use it only when you truly can't create the migration first.

Field syntax when you must invent a schema.

php artisan admin:generate Products \
  --fields="name:string,price:decimal,description:text,active:boolean,category_id:integer:foreign,category"

The shape is name:type[:modifier][:relationship]. The final segment is the related model for dropdowns. This writes a migration too if --with-migration is passed. Expect to hand-correct the migration — the generator guesses decimal precision and indexes poorly.

Regenerating after schema changes. Treat the generated controller and views as starting points you now own. The generator will happily overwrite them. The pattern that works: commit before regenerating, then diff. If you added a column, git diff shows the safe additions next to your customizations, and you can cherry-pick. Do not regenerate blindly in production-adjacent branches.

Customize the templates once, not the output many times. If your team has a house style for index tables (extra filter inputs, a custom bulk action, a specific column ordering), publish the templates:

php artisan vendor:publish --tag=admin-generator-templates

Edit under resources/views/vendor/admin-generator/ or config/admin-generator.php's template path, and every future admin:generate inherits your conventions. This is the highest-leverage investment with this package.

Wiring permissions. The generator emits a seeder that inserts the four CRUD permissions (admin.{plural}.index, .create, .edit, .destroy) and a role. Run it explicitly — it doesn't auto-run:

php artisan db:seed --class={Plural}PermissionsSeeder

Then attach the permissions to roles in your auth layer. If you skip this, logged-in admins will see empty pages with 403s.

Relationships. For a belongsTo dropdown to actually work, the *_id column must have a real foreign key constraint in the database and the related model must exist. The generator only emits a select when the FK is present; a bare author_id integer column is treated as a plain input. Add the constraint in the migration before generating. For hasMany/belongsToMany, expect to write the Craftable relationship form fields by hand — the generator does not infer pivot tables.

Locale and translation. Pass a locale or use brackets/translatable models as the source. The generator produces per-locale lang files under resources/lang/{locale}/admin/. If your app has multiple locales, generate once and copy the lang files; per-locale regeneration duplicates route registrations in admin.php.

Gotchas and Tips

Pin your Laravel version. The package's README is explicit about Laravel 8. On Laravel 9+ it may install but the generated code assumes the Laravel 8 conventions the templates were written against. Check composer.json constraints in the package before upgrading Laravel; a failing admin:generate after an upgrade usually means a template references a removed facade or helper.

Maintenance risk is real. Last release was October 2023, 50 stars, zero dependents. Do not build your admin strategy around this package's future. The value is one-off scaffolding — you keep the generated code even if you uninstall the package. Vendor the templates you rely on and you're insulated.

Duplicate route blocks. Running admin:generate Posts twice appends the route block twice in routes/admin.php. There is no dedupe. Open the file and delete the duplicate after any regeneration — the second block silently shadows the first and confuses route:list debugging.

"Class not found" on generate. The generator assumes the model exists or derives it from the table name. Custom table names with unrelated models (wp_posts → Post) fail. Pass --table=wp_posts explicitly and create the model first, or let --with-model create it and rename.

FK detection needs real constraints. This is the single most common surprise: author_id gets an integer input instead of a dropdown because the migration wrote the column without ->foreign(). Fix the migration, migrate:fresh, regenerate. The generator does not guess from naming conventions alone.

Permissions seeder collides. Re-running a seeder after regeneration will attempt to insert duplicate permissions. Wrap the insert in updateOrCreate by slug, or truncate the relevant rows manually during dev.

Media fields are half-done. brackets/media and image upload columns are recognized but the generated form field doesn't always include the upload UI wiring. Expect to edit the create/edit blade files, which is fine — the hard part (routes, controller, requests, permission gates) is already done for you.

Debugging output. If a generated page 500s, check in this order: (1) did you run migrate and the permission seeder; (2) is the transformer class name in the controller correct (regeneration can leave stale references if you renamed the plural); (3) is the route registered under the admin. name prefix in routes/admin.php; (4) does the lang file key match the column name (hyphens vs underscores). The generator is loud about writes but quiet about these mismatches.

Extension point that actually saves time. config/admin-generator.php exposes controller namespace, view path, and template directory. Overriding the view path lets you keep admin views out of resources/views/admin/ — useful if you version admin screens separately or split the admin UI into its own package.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager