NHRROB Crud Generator Package
This package provides an artisan command to generate a basic crud
composer install command:
composer require nhrrob/crudgenerator
Crud Generator Commands
- install:
php artisan crud:generator
- If you want to keep backend files under Admin folder
File Structure: Check below (Section => Bonus : Admin File Structure)
php artisan crud:generator --admin
- Migration: Add title field and run migration
- add field:
$table->string('title');
- run migration:
php artisan migrate
Note:
- This package creates resource route. Example:
- Model title: Post
- Resource route: example.com/posts
- If you want to use Api, make sure Passport is installed.
Link: https://github.com/nhrrob/laravelwiki
Loom Videos:
-
Laravel 8 project installation with auth:
https://www.loom.com/share/681f186c6f61490f8e2df97cfc86afdd -
Laravel Crud using nhrrob/crudgenerator:
https://www.loom.com/share/b860fb8c3ad2406fbd8661f2946f5cd7
Modify Stubs:
- Publish vendor files
php artisan vendor:publish
Remove Crud Generated Files:
- Delete Crud
php artisan crud:generator:delete
- If you have generated crud under Admin folder:
php artisan crud:generator:delete --admin
- Manually delete migration file and remove route from web.php
Feel free to contact:
nazmulrobin.com | Twitter | Linkedin | Email
Bonus
Laravel 8 auth using laravel/ui:
composer require laravel/ui
php artisan ui bootstrap --auth
npm install && npm run dev
php artisan migrate
Bonus : API
API Helpline:
https://github.com/nhrrob/laravelwiki
After refreshing database re create personal access token for passport
php artisan passport:install
Bonus : Admin File Structure
-
When you add --admin in crud generator commands =>
It adds admin folder for views and Admin folder for controllers (including Api) -
Sample File/Folder Structure:
#Controllers
app/Http/Controllers/
app/Http/Controllers/Admin
#Views
resources/views/
resources/views/admin
------------------------------
#API Controllers
app/Http/Controllers/Api
app/Http/Controllers/Api/Admin