# Common Development Tasks

This document collects frequently used commands and workflows.

## Artisan commands

### Create a super admin

```bash
php artisan admin:create-super admin@example.com
```

You will be prompted for a password.

### Download location data

```bash
php artisan locations:download
```

Downloads and filters location data into `database/data/locations.json`.

### Release expired pending reservations

```bash
php artisan pending-reservations:release-expired
```

Finds expired pending reservations and releases held availability. This also runs every minute via the scheduler.

### Send due notifications

```bash
php artisan notifications:send-due
```

Dispatches reminder notifications that are due. Runs every minute via the scheduler.

## Database

### Fresh migrate and seed

```bash
php artisan migrate:fresh --seed
```

### Run a specific seeder

```bash
php artisan db:seed --class=LocationSeeder
```

### Reset test database

Tests use an in-memory SQLite database, so no manual reset is needed.

## Caching

### Clear all caches

```bash
php artisan optimize:clear
```

> In some local environments this may report a missing MySQL `cache` table. This is an environment quirk and does not affect the test suite.

### Cache routes and config for production-like testing

```bash
php artisan config:cache
php artisan route:cache
php artisan optimize
```

## Queue worker

For local development, the queue worker is started by:

```bash
composer run dev
```

To run it manually:

```bash
php artisan queue:listen --tries=1
```

## Troubleshooting

### Tests fail with database errors

Ensure `phpunit.xml` uses SQLite in-memory and that the SQLite extension is enabled.

### `npm run build` fails

Make sure `resources/js/app.js` and `resources/css/app.css` exist. They are minimal but required for Vite.

### Media uploads return 404

Ensure the storage link exists:

```bash
php artisan storage:link
```

### OTP not sent

Verify CoreVerde configuration in `.env` and that `COREVERDE_ENABLED` is `true`.
