Laravel crod is a package for implementing CRUD faster & easier. You can create controllers, models, migrations, services, repositories, views and requests quickly. You can make automatically fillable for models, query for repositories & services, make resource functions for controllers.
- PHP >= 7.4
- doctrine/dbal > 3.3
- Laravel framework >= 7
composer require milwad/laravel-crod
After publish config files.
php artisan vendor:publish --provider="Milwad\LaravelCrod\LaravelCrodServiceProvider" --tag="config"
Run the command in cmd or terminal.
php artisan
You must see this command in the terminal.
This command creates CRUD files, Run this command in the terminal.
php artisan crud:make {name} {--service} {--repo} {--test}
For example
php artisan crud:make Product --service --repo --test
✅ After you can see crod creates files for crud
This command adds query & date to CRUD files.
** You must run the migrate command. **
php artisan migrate
Run this command in the terminal.
php artisan crud:query {table_name} {model} {--id-controller}
For example
php artisan crud:query products Product
When write --id-controller option add function without route model binding.
After you can see add query to service, repository, controller, model, etc.
Run this command in the terminal, This command created CRUD file for module.
php artisan crud:make-module {module_name} {--service} {--repo} {--test}
For example
php artisan crud:make-module Product --service --repo --test
This command adds query & date to CRUD files for module.
** You must run your migration file. **
php artisan crud:query-module {table_name} {model} {--id-controller}
For example
php artisan crud:query-module products Product
OR
php artisan crud:query-module products Product --id-controller
When write --id-controller option add function without route model binding.
After you can see add query to service, repository, controller, model, etc for module.
You can custom file path in config file. config/laravel-crod.php
<?php
return [
/**
* Modules config.
*
* You can make custom modules with special folders ...
*/
'modules' => [
'module_namespace' => 'Modules',
'repository_namespace' => 'Repo',
'model_path' => 'Entities',
'migration_path' => 'Database\Migrations',
'controller_path' => 'Http\Controllers',
'request_path' => 'Http\Requests',
'view_path' => 'Resources\Views',
'service_path' => 'Services',
'repository_path' => 'Repositories',
'feature_test_path' => 'Tests\Feature',
'unit_test_path' => 'Tests\Unit',
],
/**
* Queries.
*/
'queries' => [
'except_columns_in_fillable' => [
'id', 'updated_at', 'created_at'
]
]
];
This config file is very helpful to custom path or latest name file.
- This package is created and modified by Milwad Khosravi for Laravel >= 7 and is released under the MIT License.
Run the tests with:
vendor/bin/phpunit
composer test
composer coverage
This project exists thanks to all the people who contribute. CONTRIBUTING
If you've found a bug regarding security please mail milwad.dev@gmail.com instead of using the issue tracker.