🆘 WARNING Repo is still work in progress. Check the to-do list for current status.
‼️
- generate basic React CRUD pages
- to do CRUD with spatie media upload
- role CRUD
- user CRUD with role
- example for Authorization based on role and permission
- prefix sub-directory (eg: admin, frontend) with generate commands
- one command to generate both backend and frontend files
- impersonate as a user
- example REST api endpoint and usage in React code
⚠️ ATTENTION This is a starter template. Clone or fork this repo. Develop and commit in a new repo. Do not commit to this repo.‼️
- php 8.2 or 8.3
- composer 2.8.1
- node 22.14.0
- pnpm install guide
- mysql
- apache/nginx
- clone or fork
[email protected]:mrlinnth/laravel12-starter.git - create database
- change to project directory
- copy
.env.exampleto.env - update
.envwith correct settings - run
composer install - run
php artisan key:generate - run
php artisan migrate:refresh --seed - run
pnpm install - run
pnpm devfor local development orpnpm buildfor deployment
- Blueprint
- Laravel Debugbar
- Laravel Excel
- Laravel File Geneator
- Laravel Pint
- Laravel Sanctum
- Laravel Telescope
- Orion
- Spatie - Laravel Activity Log
- Spatie - Laravel Media Library
- Spatie - Laravel Permission
- Spatie - Laravel Query Builder
- Ziggy
laravel12-starter
├── app
│ ├── Console
│ │ └── Commands
│ │ └── ShadcnCrud.php (Custom command to generate React CRUD pages)
│ ├── Enums
│ ├── Exports
│ ├── Http
│ │ ├── Controllers
│ │ │ ├── Auth
│ │ │ ├── Settings
│ │ │ └── PlaygroundController.php
│ │ └── Requests
│ ├── Models
│ ├── Policies
│ └── Providers
├── bootstrap
├── config
├── database
│ ├── factories
│ ├── migrations
│ └── seeders
├── public
├── resources
│ ├── boilerplates (Templates for custom file generate)
│ ├── css
│ ├── js
│ │ ├── components
│ │ │ └── ui (Shadcn components)
│ │ ├── hooks
│ │ ├── layouts
│ │ ├── lib
│ │ ├── pages
│ │ │ ├── auth
│ │ │ ├── settings
│ │ │ ├── dashboard.tsx
│ │ │ └── welcome.tsx
│ │ ├── types
│ │ └── app.tsx
│ └── views
├── routes
│ └── web.php
└── storage| Name | Login Email | Password | Role | Permissions |
|---|---|---|---|---|
| Super Admin | [email protected] | password | god | * |
| Manager User | [email protected] | password | manager | create,read,update,delete |
| User | [email protected] | password |
- Use Spatie - Laravel Media Library to associate file to model
- Check sample code in Todo CRUD files
💡 Advice Copy and paste existing file/directory. Find and replace. Voila.
- Generate migration, seeder, model, controller, request files using blueprint for your entity (refer to
draft.yaml.exampleand create your owndraft.yaml) - Delete blueprint generated view direcotry under
resources/views - Update blueprint generated controller file to return
Inertia::renderinstead of bladeview - Update
routes/web.php - Make changes to other blueprint generated files if necessary
- Run
php artisan migrate:refresh --seed
- Generate react crud files using
php artisan make:shadcn-crud comment(custom artisan command which uses Laravel File Generator package) - Make necessary changes to generated react crud files
- Update
resources/js/components/app-sidebar.tsxwith new route
- Create factory and seeder (optional)
- If model not exist, create and extends
BaseModel - If controller not exist, create a resource controller
- If request not exist, create a form request
- Update web.php with new route(s)
- Generate react crud files using
php artisan make:shadcn-crud role - Make necessary changes to generated react crud files
- Run
php artisan migrate:refresh --seed - Update
resources/js/components/app-sidebar.tsxwith new route
- Refer to Spatie - Laravel Permission
- check
database/seeders/DatabaseSeeder.phpDatabaseSeeder class for how to create role, permission and assign to user app/Models/User.phpUser model hasis_super_admin,main_role,can_docustom attributes- for frontend authorization, check
resources/js/components/buttons/create-btn.tsx, Create button is hidden for user withoutcreatepermission - for backend authorization, check
app/Policies/TodoPolicy.phpTodoPolicy classupdatemethod andapp/Http/Controllers/TodoController.phpTodoController classeditandupdatemethods secretroute inroutes/web.phpis available only to super admin user
- Check
app\Http\Controllers\Api\UserController.phpApi/UserController and Orion documentation
- Check
app\Http\Controllers\Api\TodoStatusController.phpApi/TodoStatusController - Must follow Orion Response object structure to have a consistant API responses
- Check
resources\js\components\inputs\country-select.tsxCountrySelect component and/playgroundpage
- Check
resources\js\components\todo\todo-status-dropdown.tsxTodoStatusDropdown component and/todospage