vickymaulana / buatcrud
A Laravel package to generate CRUD operations with advanced features.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/vickymaulana/buatcrud
Requires
- php: >=8.2
- illuminate/support: ^11.0
README
This package provides an easy-to-use Artisan command to generate a complete CRUD (Create, Read, Update, Delete) system in Laravel projects. It supports advanced features such as custom fields, automatic view generation, route management, sidebar integration, and request validation.
Features
- Customizable CRUD Generation: Easily define custom fields and generate the necessary migration, model, controller, and views.
- Form Request Validation: Automatically includes form requests for input validation.
- Blade Templates for Views: Generates views for listing, creating, editing, and showing records.
- Sidebar Integration: Offers an option to integrate the generated CRUD into your Laravel project's sidebar.
- Automatic Route Handling: Adds routes for the generated CRUD operations in
web.php. - Laravel Policy Generation: Generates policies to handle authorization for the generated model.
Installation
To install the package in your Laravel project, you can add it via Composer:
composer require vickymaulana/buatcrud
Alternatively, you can manually add it to your composer.json:
{
"require": {
"vickymaulana/buatcrud": "^1.0"
}
}
Then, run:
composer update
Service Provider
Once installed, the package will automatically register its service provider using Laravel's auto-discovery feature. However, if you need to manually register the service provider, you can do so in the config/app.php file:
'providers' => [ // Other Service Providers VickyMaulana\BuatCrud\BuatCrudServiceProvider::class, ],
Usage
After installing the package, you can use the following Artisan command to generate CRUD operations for any model:
php artisan buatcrud {name} --fields={field1:type1,field2:type2,...}
{name}: The name of the model for which you want to generate CRUD (e.g.,Product).--fields: Specify fields and their types in the formatfield:type. Types can include typical Laravel migration types likestring,text,integer,decimal, etc.
Example:
php artisan buatcrud Product --fields="name:string,price:decimal,description:text"
This command will generate:
- A model and migration for
Product. - A resource controller for CRUD operations.
- Blade templates for listing, creating, editing, and viewing the product.
- Form request validation rules.
- Optional sidebar link (with confirmation).
Package Structure
- src/: Contains the package source code, including the service provider and console command.
- BuatCrudServiceProvider: Registers the package and makes the command available.
- Commands/BuatCrud.php: The Artisan command logic that generates the CRUD files.
Requirements
- Laravel 11+
- PHP 8.2+
- Laravel11-Stisla
License
The BuatCrud package is open-sourced software licensed under the MIT license.
Author
- Vicky Maulana
GitHub: vickymaulana
Email: vickymaulanna@gmail.com
Feel free to contribute by submitting pull requests, reporting issues, or suggesting features.