# mrstzz/php-raffle architecture

> Architecture diagram of the GitHub repository mrstzz/php-raffle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrstzz/php-raffle
- Repository: https://github.com/mrstzz/php-raffle

## Overview

This is a small Laravel/Livewire raffle application with authenticated access. Visitors can submit a unique email to the current raffle; the application records applicants and exposes participant and winner behavior. Separate login/logout and admin-raffle UI components are present. The README describes Laravel generally, not this product’s capabilities; edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`routes/web.php`](https://github.com/mrstzz/php-raffle/blob/main/routes/web.php) (Web routes), [`app/Livewire/RaffleApplication.php`](https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/RaffleApplication.php) (Raffle application), [`app/Livewire/Page/Auth/Login.php`](https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/Page/Auth/Login.php) (Login component), [`resources/views/components/layouts/app.blade.php`](https://github.com/mrstzz/php-raffle/blob/main/resources/views/components/layouts/app.blade.php) (Authenticated layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_layout["Authenticated layout<br/>[app.blade.php]"]
end

subgraph group_raffle["Raffle application"]
  node_raffle_app["Raffle application"]
  node_raffle_view["Application view"]
  node_raffle_model["Raffle model<br/>[Raffle.php]"]
  node_applicant_model["Applicant model<br/>[Applicant.php]"]
  node_admin_raffle["Admin raffle UI<br/>[Raffle.php]"]
  node_admin_view["Admin raffle view<br/>[raffle.blade.php]"]
end

subgraph group_identity["Identity and access"]
  node_login["Login component<br/>[Login.php]"]
  node_login_view["Login view<br/>[login.blade.php]"]
  node_logout["Logout controller"]
  node_user_model["User model<br/>[User.php]"]
  node_access_policy["Admin gate"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_web_routes
node_web_routes -->|"routes to"| node_raffle_app
node_web_routes -->|"routes to"| node_login
node_web_routes -->|"routes to"| node_logout
node_raffle_app -->|"renders"| node_raffle_view
node_raffle_app -->|"loads raffle"| node_raffle_model
node_raffle_app -->|"creates applicants"| node_applicant_model
node_raffle_model -->|"has many"| node_applicant_model
node_login -->|"renders"| node_login_view
node_login -->|"uses layout"| node_layout
node_layout -->|"checks admin"| node_access_policy
node_access_policy -->|"checks user flag"| node_user_model
node_logout -.->|"ends session"| node_user_model
node_admin_raffle -.->|"renders"| node_admin_view

click node_web_routes "https://github.com/mrstzz/php-raffle/blob/main/routes/web.php"
click node_raffle_app "https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/RaffleApplication.php"
click node_raffle_view "https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/raffle-application.blade.php"
click node_raffle_model "https://github.com/mrstzz/php-raffle/blob/main/app/Models/Raffle.php"
click node_applicant_model "https://github.com/mrstzz/php-raffle/blob/main/app/Models/Applicant.php"
click node_admin_raffle "https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/Page/Admin/Raffle.php"
click node_admin_view "https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/page/admin/raffle.blade.php"
click node_login "https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/Page/Auth/Login.php"
click node_login_view "https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/auth/login.blade.php"
click node_logout "https://github.com/mrstzz/php-raffle/blob/main/app/Http/Controllers/Auth/LogoutController.php"
click node_user_model "https://github.com/mrstzz/php-raffle/blob/main/app/Models/User.php"
click node_access_policy "https://github.com/mrstzz/php-raffle/blob/main/app/Providers/AppServiceProvider.php"
click node_layout "https://github.com/mrstzz/php-raffle/blob/main/resources/views/components/layouts/app.blade.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_routes,node_layout toneBlue
class node_raffle_app,node_raffle_view,node_raffle_model,node_applicant_model,node_admin_raffle,node_admin_view toneAmber
class node_login,node_login_view,node_logout,node_user_model,node_access_policy toneMint
class node_visitor toneIndigo
```

## Components

### Web entry

- [Web routes](https://github.com/mrstzz/php-raffle/blob/main/routes/web.php): `routes/web.php`
- [Authenticated layout](https://github.com/mrstzz/php-raffle/blob/main/resources/views/components/layouts/app.blade.php): `resources/views/components/layouts/app.blade.php`

### Raffle application

- [Raffle application](https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/RaffleApplication.php): `app/Livewire/RaffleApplication.php`
- [Application view](https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/raffle-application.blade.php): `resources/views/livewire/raffle-application.blade.php`
- [Raffle model](https://github.com/mrstzz/php-raffle/blob/main/app/Models/Raffle.php): `app/Models/Raffle.php`
- [Applicant model](https://github.com/mrstzz/php-raffle/blob/main/app/Models/Applicant.php): `app/Models/Applicant.php`
- [Admin raffle UI](https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/Page/Admin/Raffle.php): `app/Livewire/Page/Admin/Raffle.php`
- [Admin raffle view](https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/page/admin/raffle.blade.php): `resources/views/livewire/page/admin/raffle.blade.php`

### Identity and access

- [Login component](https://github.com/mrstzz/php-raffle/blob/main/app/Livewire/Page/Auth/Login.php): `app/Livewire/Page/Auth/Login.php`
- [Login view](https://github.com/mrstzz/php-raffle/blob/main/resources/views/livewire/auth/login.blade.php): `resources/views/livewire/auth/login.blade.php`
- [Logout controller](https://github.com/mrstzz/php-raffle/blob/main/app/Http/Controllers/Auth/LogoutController.php): `app/Http/Controllers/Auth/LogoutController.php`
- [User model](https://github.com/mrstzz/php-raffle/blob/main/app/Models/User.php): `app/Models/User.php`
- [Admin gate](https://github.com/mrstzz/php-raffle/blob/main/app/Providers/AppServiceProvider.php): `app/Providers/AppServiceProvider.php`

### Other components

- **Visitor**

## Connections

- Visitor → Web routes: requests pages (evidence: `routes/web.php`)
- Web routes → Raffle application: routes to (evidence: `routes/web.php`)
- Web routes → Login component: routes to (evidence: `routes/web.php`)
- Web routes → Logout controller: routes to (evidence: `routes/web.php`)
- Raffle application → Application view: renders (evidence: `app/Livewire/RaffleApplication.php`)
- Raffle application → Raffle model: loads raffle (evidence: `app/Livewire/RaffleApplication.php`)
- Raffle application → Applicant model: creates applicants (evidence: `app/Livewire/RaffleApplication.php`)
- Raffle model → Applicant model: has many (evidence: `app/Models/Raffle.php`)
- Login component → Login view: renders (evidence: `app/Livewire/Page/Auth/Login.php`)
- Login component → Authenticated layout: uses layout (evidence: `resources/views/components/layouts/app.blade.php`)
- Authenticated layout → Admin gate: checks admin (evidence: `resources/views/components/layouts/app.blade.php`)
- Admin gate → User model: checks user flag (evidence: `app/Providers/AppServiceProvider.php`)
- Logout controller → User model: ends session
- Admin raffle UI → Admin raffle view: renders
