# REDSOM GROUP — Laravel Website

The public website + a password-protected **Image Manager** admin panel so
photos are stored on the server (via a database + `public/uploads`) and are
visible to every visitor — not just the browser that uploaded them.

## What's included

- `/` — the public homepage (`resources/views/site/home.blade.php`)
- `/login` — admin sign-in
- `/admin/images` — Image Manager (protected, requires login)
- `site_images` table — one row per uploaded photo (slot key + file path)
- Uploaded files are written to `public/uploads/site-images/` — **no
  `php artisan storage:link` symlink required**, which matters on shared
  cPanel hosting where that step can be awkward without terminal access.

To add a new manageable photo slot anywhere on the site, add one line to
`config/site_images.php` and a matching `data-img-slot="..."` element in
`resources/views/site/home.blade.php`.

## 1. Build locally first

This project ships as Laravel **source code** — the `vendor/` folder (third
party packages) isn't included, so install it on a machine with Composer
before uploading to cPanel:

```bash
composer install --no-dev --optimize-autoloader
```

Then set up your environment:

```bash
cp .env.example .env
php artisan key:generate
```

Open `.env` and set:

- `APP_URL` — your real domain, e.g. `https://redsom.so`
- `ADMIN_EMAIL` / `ADMIN_PASSWORD` — the login for `/login` and `/admin/images`
- Database — SQLite works out of the box for a small site. To use MySQL
  instead (recommended on cPanel), set:
  ```
  DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=your_cpanel_db_name
  DB_USERNAME=your_cpanel_db_user
  DB_PASSWORD=your_cpanel_db_password
  ```

If staying on SQLite, create the database file before migrating:

```bash
mkdir -p database
touch database/database.sqlite
```

Run migrations and seed the admin account:

```bash
php artisan migrate --force
php artisan db:seed --force
```

## 2. Upload to cPanel (ZIP method, no SSH needed)

1. Zip the **entire project folder**, including the `vendor/` directory you
   just installed, and the `.env` file you just configured.
2. In cPanel → **File Manager**, upload the zip and extract it into a
   folder outside `public_html` if possible (e.g. `/home/youruser/redsom-app`) —
   this keeps `.env`, `app/`, and other source files out of the web root.
3. In cPanel → **Domains** (or **Addon Domains**), point the domain's
   **Document Root** to the project's `public/` folder
   (e.g. `/home/youruser/redsom-app/public`).
   - If your hosting plan doesn't let you change the document root, the
     simpler fallback is to extract the whole project directly into
     `public_html`, then move the *contents* of `public/` into
     `public_html/` and edit `public_html/index.php` so the two `require`
     paths point up to `../app_root/vendor/autoload.php` and
     `../app_root/bootstrap/app.php`.
4. In cPanel → **MySQL® Databases**, create a database + user if you're
   using MySQL instead of SQLite, and match those credentials in `.env`.
5. Make sure these folders are writable by the web server:
   `storage/`, `bootstrap/cache/`, and `public/uploads/site-images/`.
   In File Manager, right-click each → **Permissions** → `755` (or `775`
   if uploads still fail).
6. If cPanel gives you **Terminal** access (Setup PHP App often includes a
   "Run Composer" / terminal button), you can instead skip step 1's zip of
   `vendor/` and just run `composer install`, `php artisan migrate --force`,
   and `php artisan db:seed --force` directly on the server.

## 3. First login

Visit `https://yourdomain.com/login` and sign in with the `ADMIN_EMAIL` /
`ADMIN_PASSWORD` you set in `.env` before seeding. Change that password by
updating `.env` and re-running the seeder, or by adding a simple "change
password" form later if you'd like — happy to build that next.

## Notes

- `APP_DEBUG` is set to `false` in `.env.example` for production — keep it
  that way once live, so errors don't leak stack traces to visitors.
- The homepage and the Image Manager share the same `public/css` and
  `public/js` files as the static prototype you saw earlier — no build
  step (npm/vite) is required to view the site.
