# Lekha Mantra Hostinger Deployment

This package is prepared for a Laravel shared-hosting deployment with built frontend assets and Composer dependencies included.

## 1. Upload

Upload `lekha-mantra-hostinger-ready.zip` to Hostinger File Manager and extract it.

Recommended structure:

```text
domains/your-domain.com/lekha-mantra
domains/your-domain.com/public_html
```

Best option: set your domain document root to:

```text
domains/your-domain.com/lekha-mantra/public
```

If Hostinger does not allow the document root to point to `/public`, copy the contents of `lekha-mantra/public` into `public_html`, then edit `public_html/index.php`:

```php
require __DIR__.'/../lekha-mantra/vendor/autoload.php';
$app = require_once __DIR__.'/../lekha-mantra/bootstrap/app.php';
```

## 2. Environment

Copy `.env.hostinger.example` to `.env`.

Update:

```text
APP_URL
DB_HOST
DB_DATABASE
DB_USERNAME
DB_PASSWORD
MAIL_*
```

Use PostgreSQL if available. If your hosting account only provides MySQL, change:

```text
DB_CONNECTION=mysql
DB_PORT=3306
```

## 3. First Run Commands

Run these from the Laravel project folder:

```bash
php artisan key:generate --force
php artisan migrate --force
php artisan storage:link
php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache
```

Optional demo data:

```bash
php artisan db:seed --class=Database\\Seeders\\RolesAndPermissionsSeeder --force
```

Demo credentials after seeding:

```text
admin / Password@12345
client / Password@12345
franchise / Password@12345
taxclient / Password@12345
```

Change or remove demo users before real production use.

## 4. Permissions

Make these folders writable:

```text
storage
bootstrap/cache
```

## 5. Cron and Queues

Add this cron job in Hostinger:

```bash
* * * * * php /home/YOUR_USERNAME/domains/your-domain.com/lekha-mantra/artisan schedule:run >> /dev/null 2>&1
```

For notifications and queued jobs, run a queue worker if your plan supports it:

```bash
php artisan queue:work --tries=3
```

If long-running workers are not supported, add a cron command:

```bash
* * * * * php /home/YOUR_USERNAME/domains/your-domain.com/lekha-mantra/artisan queue:work --stop-when-empty --tries=3 >> /dev/null 2>&1
```

## 6. Final Checks

Open:

```text
https://your-domain.com
https://your-domain.com/login
```

Confirm:

- Landing page loads.
- Login works.
- Admin dashboard opens.
- Storage uploads work.
- PDF and Excel reports generate.
