# MCSS — Setup Instructions
# How to drop these files into a fresh `laravel new mcss` project

## The Problem You Hit
You see the default Laravel welcome page because `routes/web.php` hasn't been replaced yet.
The generated files go INTO your existing Laravel project — they don't replace it wholesale.

---

## Step 1 — Copy Generated Files Into Your Laravel Project

From the downloaded zip, copy files matching this structure into your project root:

```
your-laravel-project/
├── app/
│   ├── Http/
│   │   ├── Controllers/
│   │   │   ├── Admin/
│   │   │   │   └── SuperAdminController.php       ← COPY
│   │   │   ├── Auth/
│   │   │   │   └── AuthController.php             ← COPY
│   │   │   └── School/
│   │   │       ├── GradesController.php           ← COPY
│   │   │       ├── StudentController.php          ← COPY
│   │   │       ├── TranscriptController.php       ← COPY
│   │   │       └── TransferController.php         ← COPY
│   │   ├── Kernel.php                             ← REPLACE (not add)
│   │   └── Middleware/
│   │       ├── TenantMiddleware.php               ← COPY
│   │       ├── RoleMiddleware.php                 ← COPY
│   │       └── LogActivity.php                   ← COPY
│   ├── Models/                                    ← COPY ALL .php files
│   └── Services/                                 ← COPY ALL .php files
├── database/
│   ├── migrations/                               ← COPY ALL migration files
│   └── seeders/
│       └── DatabaseSeeder.php                    ← REPLACE
├── resources/
│   └── views/                                    ← COPY entire views/ folder
└── routes/
    └── web.php                                   ← REPLACE (this is why you see welcome page)
```

---

## Step 2 — Run These Commands

```bash
# 1. Generate app key (if not done yet)
php artisan key:generate

# 2. Install the PDF package
composer require barryvdh/laravel-dompdf

# 3. Wipe any old route/view cache
php artisan route:clear
php artisan view:clear
php artisan config:clear

# 4. Run migrations and seed
php artisan migrate:fresh --seed

# 5. Create storage symlink (for transcript PDFs)
php artisan storage:link
```

---

## Step 3 — Verify Routes Are Working

```bash
php artisan route:list | grep login
```

You should see:
```
GET|HEAD  login    login    App\Http\Controllers\Auth\AuthController@showLogin
```

If you see the old welcome route instead, your `routes/web.php` wasn't replaced.

---

## Step 4 — Login

Open: http://localhost:8000/login  (or your domain)

| Role         | Email                    | Password   |
|--------------|--------------------------|------------|
| Super Admin  | admin@mcss.edu.lr        | password   |
| School Admin | admin@GWG.edu.lr         | password   |
| Registrar    | registrar@GWG.edu.lr     | password   |
| Teacher      | teacher@GWG.edu.lr       | password   |

**Change all passwords immediately.**

---

## Common Errors & Fixes

| Error | Fix |
|-------|-----|
| Still seeing welcome page | Replace `routes/web.php` with the generated one |
| `Class [Middleware] not found` | Check `app/Http/Kernel.php` was replaced, not added alongside |
| `View not found` | Ensure `resources/views/` folder structure was copied correctly |
| `Table not found` | Run `php artisan migrate:fresh --seed` |
| Transcript PDF blank | Run `php artisan storage:link`, check `storage/app/public/` is writable |
| `Target class does not exist` | Your Kernel.php still references old Laravel middleware paths — replace with the provided Kernel.php |
