arrahmouni / crud-generator
Generate crud for laravel modules
1.0.1
2025-06-28 13:29 UTC
Requires
- php: ^8.0
- laravel/framework: >=10.0
- nwidart/laravel-modules: >=10.0
This package is auto-updated.
Last update: 2025-06-28 13:35:55 UTC
README
A powerful CLI tool to generate complete CRUD operations with translations, permissions, and modular architecture support.
📦 Features
- One-Command CRUD Generation
- Multilingual Support (Model translations + migration translations)
- Modular Architecture (Works with nwidart/laravel-modules)
- Optional Components:
- Soft Delete & Disabled Status
- API Controllers
- Permissions System
- Factories & Seeders
- Form Requests
- Blade Views
- Custom Stub Support
- Automatic Route Generation
- Permission Seeding
🚀 Installation
- Install via Composer:
composer require arrahmouni/crud-generator
- Publish configuration and stubs:
php artisan vendor:publish --provider="CrudGeneratorServiceProvider" --tag=config php artisan vendor:publish --provider="CrudGeneratorServiceProvider" --tag=stubs
🛠 Configuration
Edit config/crud.php
to customize:
return [ 'stub_path' => resource_path('stubs/'), // Custom stub path // Add other configuration parameters ];
🎯 Basic Usage
Generate a full CRUD structure with interactive prompts:
php artisan create:crud ModelName ModuleName
Example - Create a Product CRUD in Catalog module:
php artisan create:crud Product Catalog
🔧 Command Workflow
You'll be asked about these options during generation:
- Soft Delete
- Disabled Status
- Translations
- Migrations
- Factories
- Seeders
- Requests
- Controllers (Web + API)
- Permissions
- Views
📂 Generated Structure
ModuleName/
├── Models/
│ └── ModelName.php
├── Resources/
│ └── views/index.blade.php
│ └── views/create.blade.php
│ └── views/update.blade.php
├── Http/
│ ├── Controllers/Admin
│ ├── Controllers/Api
│ └── Requests/
├── Resources/
│ ├── ModelResource.php
├── Database/
│ ├── migrations/
│ ├── factories/
│ └── seeders/
└── Routes/
└── web.php (auto-updated)
🔄 Post-Creation Steps
-
Add translations to language files:
admin::dashboard
admin::cruds
admin::datatables
-
Configure permissions in Permission module config
-
Sync permissions:
php artisan module:seed Permission
- Run migrations:
php artisan module:migrate ModuleName
🛡 Service Provider
The CrudGeneratorServiceProvider
handles:
- Command registration
- Stub path configuration
- Package asset publishing
- Configuration management
📜 License
This package is open-source software licensed under the MIT license.
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Happy CRUD Generation! 🚀