# MASTER_COMMANDS.md — Habib Cables ERP

Every command you need, grouped by task. Windows/Laragon is the primary local environment.

## Setup
```bash
composer install
npm install
cp .env.example .env        # PowerShell: copy .env.example .env
php artisan key:generate
php artisan migrate --seed
npm run build               # or `npm run dev` for HMR
```

## Day-to-day development
```bash
composer run dev            # runs serve + queue:listen + pail + vite concurrently
php artisan serve           # app only
npm run dev                 # Vite dev server (HMR) only
php artisan queue:listen --tries=1
php artisan pail --timeout=0   # live tail of logs
```

## Database
```bash
php artisan migrate                 # apply migrations
php artisan migrate:rollback --step=1
php artisan migrate:fresh --seed    # DANGER: drops all tables (local only)
php artisan db:seed
php artisan make:migration create_x_table
```

## Testing & quality
```bash
php artisan test                    # Pest suite
php artisan test --filter=SomeTest
composer test                       # config:clear + artisan test
./vendor/bin/pint                   # format (PSR-12)
./vendor/bin/pint --test            # check formatting without writing
php artisan dusk                    # browser tests
```

## Custom integration commands (this repo)
These live in `app/Console/Commands` — run them to validate cross-module behaviour:
```bash
php artisan test:chart-of-accounts-integration   # TestChartOfAccountsIntegration
php artisan test:dual-ledger-integration         # TestDualLedgerIntegration
php artisan test:contact-account-creation        # TestContactAccountCreation
php artisan test:qc-implementation               # TestQcImplementation
php artisan test:roles-permissions               # TestRolesPermissions
php artisan test:logging                         # TestLoggingCommand
```
> Signatures may differ from the class name — run `php artisan list | grep test` to confirm the exact
> `signature` before relying on these.

## Desktop / API tokens
```bash
php artisan tinker              # inspect models, create Sanctum tokens
# GenerateApiToken command:
php artisan list | grep token   # confirm signature, then run it
```

## Build & deploy
```bash
composer install --no-dev --optimize-autoloader
npm run build
php artisan migrate --force
php artisan config:cache && php artisan route:cache && php artisan view:cache
php artisan queue:restart
```

## Debugging
```bash
php artisan pail                # live logs (preferred)
php artisan route:list          # verify which controller a route hits (find the LIVE file)
php artisan about               # environment summary
# Laravel Debugbar is enabled in dev for query/timeline inspection.
```
