# EcombeasTS Project Setup

This project was successfully migrated from a vanilla PHP/HTML frontend single-page site to a full **Laravel 12 (PHP 8.2)** architecture.

## Commands you should know
- Starting dev server locally: `php artisan serve` and `npm run dev`.
- Serving in production (Apache): Traffic is already correctly forwarded via the `.htaccess` on the root pointing to `public/`.
- Compiling assets for production: `npm run build`

## Architecture & Work Done
1.  **Auth / Accounts**: `Laravel Breeze` is installed. Users can register and gain access to a personal dashboard (`/dashboard`).
2.  **Database**: Using `MySQL`. We created a `histories` table for logged-in users to save generated images and ad text.
    - Fields: `user_id`, `type`, `target_platform`, `output_language`, `tone`, `prompt`, `result_data` (JSON).
3.  **Controllers**:
    - `AIController.php`: Handles API POST requests connecting to the custom webhooks. It now supports multiple images uploaded simultaneously via `images[]`.
    - `HistoryController.php`: Handles fetching dashboards views and deleting/saving past generations from the `result_data` array.
4.  **Frontend/Blade**:
    - Modified old Vanilla structure to fully embrace Blade components & Tailwind CSS layouts.
    - `resources/views/welcome.blade.php`: The main entry point interacting with `ai.generate` and `ai.check`.
    - `resources/views/dashboard.blade.php`: The user protected area viewing past results.
5.  **Backup**: Original JS/HTML files are preserved inside `.backup/` should they ever be needed.

## Style / Code Conventions
- We utilize Tailwind classes directly on Blade templates.
- We use the `fetch` API directly from Blade via script tags for the generation interactions. No deeply separated Vue/React SPA logic, keeping the simplicity of the legacy app.
- Multi-image payloads are sent iterating `images[]` using an HTML5 `FormData()` directly appended into Laravel's native `Http::attach()` client.