CRUD Generator

With Craftable you can quickly scaffold your typical CRUD admin interface. It generates all the code based on the existing, migrated table in the database.


Imagine you have a posts table defined with this migration:

Schema::create('posts', function (Blueprint $table) {

Let's migrate this table:

php artisan migrate

And now we are ready to generate whole CRUD interface.

php artisan admin:generate posts

You will be prompted to migrate generated migration that attaches permissions to the default Administrator role. You can read more about it, for now just choose yes

{primary} We love to organize things. That's why we have changed the default namespace for models to App\Models. But you can always specify any other (i.e. Laravel's default App\) with an -m option.

Finally we need to re-compile all the assets. If you are using Laravel with Webpack, you need to call:

npm run dev

If you are using Laravel with Vite, you need to call:

npm run craftable-dev

Now you can refresh your admin interface in a browser. You should be able to see new menu item Posts.

Generator example