# Movex Finance / Accounts Laravel Starter

This package was prepared from the uploaded Laravel base app and converted into a finance/accounting starter portal.

## Database configured in `.env`

```env
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=movecdxj_ng_finance
DB_USERNAME=movecdxj_ng_finance
DB_PASSWORD="July1972@123"
SESSION_DRIVER=file
```

`SESSION_DRIVER=file` is intentional so the login page does not crash before the database migrations are completed.

## Seeded accounts

Admin:

```text
admin@finance.test
Password@123
```

Users:

```text
user1@finance.test
Password@123

user2@finance.test
Password@123

user3@finance.test
Password@123
```

## Important role rule

Registration creates `role = user` only. Admin role can be changed manually in the database:

```sql
UPDATE users SET role = 'admin' WHERE email = 'someone@example.com';
```

Or through the seeded admin user under Admin > Users.

## Main modules included

### Admin portal

- Dashboard
- Chart of Accounts
- Finance Contacts: suppliers, customers, employees, others
- Bank Accounts
- Invoices / Receivables
- Bills / Payables
- Expense Claims approval and reimbursement
- Cash Advances approval
- Manual Journal Entries
- Budgets
- Payroll records
- Tax records
- Reports: trial balance, income statement, balance sheet summary
- User role/status management
- Audit logs

### User portal

- Dashboard
- Profile update
- Expense claim submission and tracking
- Cash advance request and tracking

## Deployment commands

Run these from the folder that contains `artisan`:

```bash
php artisan optimize:clear
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan migrate --seed
chmod -R 775 storage bootstrap/cache
```

If you get `Could not open input file: artisan`, you are in the wrong folder. Run:

```bash
find . -maxdepth 4 -name artisan -type f
```

Then `cd` into the folder containing `artisan`.

## Database privilege fix if needed

If you see error 1044 access denied, the MySQL user has not been attached to the database. In cPanel:

1. Go to MySQL Databases.
2. Add user `movecdxj_ng_finance` to database `movecdxj_ng_finance`.
3. Grant ALL PRIVILEGES.
4. Save.
5. Run `php artisan migrate --seed` again.
