# TASK 4.2: Refactor Laravel pages, admin flows, and file flows to backend APIs only

## Summary

Replace Laravel local model usage across the portal with backend API calls and authenticated user context obtained from the new auth flow.

## Dependencies

- TASK 4.1 complete
- TASK 3.1 complete
- TASK 3.2 complete

## Files to Modify

Likely files:

- `Front/app/Http/Controllers/Admin/AdminApiController.php`
- `Front/app/Http/Controllers/Admin/AdminDashboardController.php`
- `Front/app/Http/Controllers/Admin/UsersController.php`
- `Front/app/Http/Controllers/DashboardController.php`
- `Front/app/Http/Controllers/FilesController.php`
- `Front/app/Services/AiApiService.php`
- `Front/app/Services/ActivityLogger.php`
- `Front/app/Providers/MockEventProvider.php`
- `Front/resources/views/layouts/layout.blade.php`
- route files under `Front/routes`

## Required Behavior

Laravel must:

- stop using local `Customer`, `User`, `CustomerApiKey`, `UploadedFile`, and `ActivityLog` models,
- obtain current tenant/customer context from backend-authenticated user data,
- proxy or orchestrate admin/customer/file operations through backend APIs,
- render dashboard and file management views from backend data,
- stop deriving tenant headers from local DB relationships.

## Acceptance Criteria

- [ ] Admin customer flows use backend APIs only
- [ ] Admin user flows use backend/Keycloak integration only
- [ ] Dashboard recent-file flows use backend document APIs only
- [ ] File upload/remove flows no longer depend on local `UploadedFile` rows
- [ ] `AiApiService` no longer derives tenant scope from a local Eloquent relationship
- [ ] Blade views no longer depend on `auth()->user()->customer`

## Notes

- Refactor behavior around actual pages and actions, not only around class names.
- Remove route model binding assumptions tied to local DB entities.
