Package Data | |
---|---|
Maintainer Username: | mrdebug |
Maintainer Contact: | jonathan@labo-dev.fr (Jonathan Escarem) |
Package Create Date: | 2016-11-11 |
Package Last Update: | 2024-01-18 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-28 15:18:12 |
Package Statistics | |
---|---|
Total Downloads: | 19,440 |
Monthly Downloads: | 158 |
Daily Downloads: | 4 |
Total Stars: | 315 |
Total Watchers: | 7 |
Total Forks: | 44 |
Total Open Issues: | 1 |
CrudGen Laravel is a package that you can integrate in your Laravel to create a REAL CRUD (controller filled, views, model with relationships, request file with rules and the migration file).
CrudGen Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Run composer command:
composer require mrdebug/crudgen
If you don't use auto-discovery :
2. Add service provider to app.php config file.
'providers' => [
//...
Mrdebug\Crudgen\CrudgenServiceProvider::class,
]
3. If you don't use Laravel Collective Form package in your project, install it:
composer require laravelcollective/html
and add it to app.php config file :
'providers' => [
//...
Collective\Html\HtmlServiceProvider::class,
]
'aliases' => [
//...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
]
4. Publish config file and default-theme directory for views
php artisan vendor:publish
php artisan make:crud nameOfYourCrud "column1:type, column2"
Available options:
A migration file is created in your database\migrations directory. If necessary edit it and run :
php artisan migrate
Create your routes for this new controller, you can do this :
Route::resource('url', 'YourController');
A controller file is created in your app\Http\Controllers directory. All default methods (index, create, store, show, edit, update, destroy) are filled with your fields.
A request file is created in your app\Http\Requests directory. By default, all fields are required, you can edit it according to your needs.
A views directory is created in your resources/views directory. By default, all views extends a template called "default". And the content is in a section called "content". You can change it in the config file: config/crudgen.php. 2 config options are available:
Is the directory name in resources/crudgen/views, you want to use. A "default-theme" directory is added when you publish vendor assets. You can duplicate/remove it and add multiple themes according your needs.
Each 4 views (index, create, edit, show) can have different @extends and @section options
You can create views independently of the CRUD generator with :
php artisan make:views nameOfYourDirectoryViews "column1:type, column2"
You can delete all files created by the make:crud command at any time (you don't need to remove all files by hand)
php artisan remove:crud nameOfYourCrud --force
--force (optional) can delete all files without confirmation
This package is licensed under the license MIT.