🆘 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
git@github.com:mrlinnth/laravel12-starter.git
- create database
- change to project directory
- copy
.env.example
to.env
- update
.env
with correct settings - run
composer install
- run
php artisan key:generate
- run
php artisan migrate:refresh --seed
- run
pnpm install
- run
pnpm dev
for local development orpnpm build
for 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 | admin@mail.com | password | god | * |
Manager User | manager@mail.com | password | manager | create,read,update,delete |
User | user@mail.com | 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.example
and create your owndraft.yaml
) - Delete blueprint generated view direcotry under
resources/views
- Update blueprint generated controller file to return
Inertia::render
instead 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.tsx
with 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.tsx
with new route
- Refer to Spatie - Laravel Permission
- check
database/seeders/DatabaseSeeder.php
DatabaseSeeder class for how to create role, permission and assign to user app/Models/User.php
User model hasis_super_admin
,main_role
,can_do
custom attributes- for frontend authorization, check
resources/js/components/buttons/create-btn.tsx
, Create button is hidden for user withoutcreate
permission - for backend authorization, check
app/Policies/TodoPolicy.php
TodoPolicy classupdate
method andapp/Http/Controllers/TodoController.php
TodoController classedit
andupdate
methods secret
route inroutes/web.php
is available only to super admin user
- Check
app\Http\Controllers\Api\UserController.php
Api/UserController and Orion documentation
- Check
app\Http\Controllers\Api\TodoStatusController.php
Api/TodoStatusController - Must follow Orion Response object structure to have a consistant API responses
- Check
resources\js\components\inputs\country-select.tsx
CountrySelect component and/playground
page
- Check
resources\js\components\todo\todo-status-dropdown.tsx
TodoStatusDropdown component and/todos
page