myopensoft/filament-crud-generator

to be use by ost's filament project

1.0.4 2025-06-01 08:56 UTC

This package is auto-updated.

Last update: 2025-06-01 08:56:39 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package that provides a command to generate Livewire components with CRUD operations. This package simplifies the process of creating Livewire components, models, controllers, and related files for your Laravel application.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require myopensoft/filament-crud-generator

You can publish the config file with:

php artisan vendor:publish --tag="filament-crud-generator-config"

This is the contents of the published config file:

return [
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-crud-generator-views"

Usage

After installing the package, you can use the make:filament-resource command to generate a new set of Livewire components with CRUD operations:

php artisan make:filament-resource Post

This will create a new set of Livewire components for the Post model with all the necessary files for CRUD operations, including a controller and Blade views.

Options

The command supports the following options:

  • -m, --model: Create a model for the resource
  • -s, --soft-deletes: Add soft delete functionality to the model
  • -f, --force: Overwrite existing files
  • -t, --table: Specify a custom table name (default: pluralized snake_case of resource name)

Examples

Create a resource with a model:

php artisan make:filament-resource Post --model

Create a resource with a model that supports soft deletes:

php artisan make:filament-resource Post --model --soft-deletes

Force overwrite existing files:

php artisan make:filament-resource Post --force

Create a resource with a custom table name:

php artisan make:filament-resource Post --model --table=custom_posts

Configuration

You can publish the configuration file to customize the behavior of the generator:

php artisan vendor:publish --tag="filament-crud-generator-config"

This will create a filament-crud-generator.php file in your config directory where you can customize the namespaces, templates, and default options for the generator.

Generated Files

The command generates the following files:

  1. Model (optional): A basic Eloquent model with fillable attributes and table name.
  2. Livewire Components:
    • Index component for listing records with search and pagination
    • Create component for adding new records
    • Edit component for updating existing records
  3. Blade Views: Corresponding views for each Livewire component with responsive UI.
  4. Controller: A controller with an index method that includes permission checking and returns a view.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.