# hafidilasad/blog architecture

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

- Interactive diagram: https://gitdiagram.com/hafidilasad/blog
- Repository: https://github.com/hafidilasad/blog

## Overview

This Laravel 8 blog serves public post and category pages and provides authenticated author and administrator workflows for managing content and site data. A typical content-management request is routed to a controller, which uses Eloquent models and returns a Blade view; post creation also handles image uploads. The README documents Eloquent relationships, a Post observer, and custom middleware. Route declarations and several subsystem implementations were not sampled, so their internal wiring is shown only where supported by the repository structure or explicit documentation.

Main entry points: [`routes/web.php`](https://github.com/hafidilasad/blog/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/PostController.php`](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/PostController.php) (Post management), [`app/Models/User.php`](https://github.com/hafidilasad/blog/blob/main/app/Models/User.php) (User model), [`app/Providers/RouteServiceProvider.php`](https://github.com/hafidilasad/blog/blob/main/app/Providers/RouteServiceProvider.php) (Route provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web delivery"]
  node_routing["Route provider"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_front_pages["Public pages<br/>[PageController.php]"]
  node_front_views["Public views<br/>[index.blade.php]"]
end

subgraph group_content["Blog content"]
  node_post_management["Post management<br/>[PostController.php]"]
  node_category_management["Category pages"]
  node_author_management["Author pages"]
  node_content_views["Author views<br/>[index.blade.php]"]
  node_post_model["Post model<br/>[Post.php]"]
  node_category_model["Category model<br/>[Category.php]"]
  node_post_observer["Post observer<br/>[PostObserver.php]"]
end

subgraph group_admin["Administration"]
  node_admin_controllers["Admin management"]
  node_admin_views["Admin views"]
  node_settings_model["Settings model<br/>[Setting.php]"]
end

subgraph group_identity["Identity and access"]
  node_auth_controllers["Authentication"]
  node_auth_views["Auth views<br/>[register.blade.php]"]
  node_role_access["Role access<br/>[HasRoles.php]"]
  node_user_model["User model<br/>[User.php]"]
end

node_visitor(("Visitor"))
node_author(("Author"))
node_administrator(("Administrator"))
node_database[("Database")]

node_visitor -->|"requests pages"| node_routing
node_author -->|"submits requests"| node_routing
node_administrator -->|"manages site"| node_routing
node_routing -->|"loads routes"| node_web_routes
node_web_routes --> node_front_pages
node_web_routes --> node_post_management
node_web_routes --> node_category_management
node_web_routes --> node_author_management
node_front_pages -->|"renders pages"| node_front_views
node_post_management -->|"creates and updates"| node_post_model
node_post_management -->|"loads categories"| node_category_model
node_post_management -->|"renders views"| node_content_views
node_category_management --> node_category_model
node_author_management --> node_user_model
node_post_model -.->|"observes changes"| node_post_observer
node_administrator -->|"administers data"| node_admin_controllers
node_admin_controllers -->|"renders admin"| node_admin_views
node_admin_controllers --> node_settings_model
node_web_routes --> node_auth_controllers
node_auth_controllers -->|"renders registration"| node_auth_views
node_auth_controllers -->|"creates user"| node_user_model
node_user_model -->|"uses role traits"| node_role_access
node_post_model -->|"persists content"| node_database
node_category_model -->|"persists categories"| node_database
node_user_model -->|"persists accounts"| node_database
node_settings_model -->|"persists settings"| node_database

click node_routing "https://github.com/hafidilasad/blog/blob/main/app/Providers/RouteServiceProvider.php"
click node_web_routes "https://github.com/hafidilasad/blog/blob/main/routes/web.php"
click node_front_pages "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/PageController.php"
click node_front_views "https://github.com/hafidilasad/blog/blob/main/resources/views/front/index.blade.php"
click node_post_management "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/PostController.php"
click node_category_management "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/CategoryController.php"
click node_author_management "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/AuthorController.php"
click node_content_views "https://github.com/hafidilasad/blog/blob/main/resources/views/back/posts/index.blade.php"
click node_post_model "https://github.com/hafidilasad/blog/blob/main/app/Models/Post.php"
click node_category_model "https://github.com/hafidilasad/blog/blob/main/app/Models/Category.php"
click node_post_observer "https://github.com/hafidilasad/blog/blob/main/app/Observers/PostObserver.php"
click node_admin_controllers "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/Admin/AdminController.php"
click node_admin_views "https://github.com/hafidilasad/blog/blob/main/resources/views/admin/dashboard.blade.php"
click node_settings_model "https://github.com/hafidilasad/blog/blob/main/app/Models/Setting.php"
click node_auth_controllers "https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_auth_views "https://github.com/hafidilasad/blog/blob/main/resources/views/auth/register.blade.php"
click node_role_access "https://github.com/hafidilasad/blog/blob/main/app/Models/HasRoles.php"
click node_user_model "https://github.com/hafidilasad/blog/blob/main/app/Models/User.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_routing,node_web_routes,node_front_pages,node_front_views toneBlue
class node_post_management,node_category_management,node_author_management,node_content_views,node_post_model,node_category_model,node_post_observer,node_database toneAmber
class node_admin_controllers,node_admin_views,node_settings_model toneMint
class node_auth_controllers,node_auth_views,node_role_access,node_user_model toneRose
class node_visitor,node_author,node_administrator toneIndigo
```

## Components

### Web delivery

- [Route provider](https://github.com/hafidilasad/blog/blob/main/app/Providers/RouteServiceProvider.php): `app/Providers/RouteServiceProvider.php`
- [Web routes](https://github.com/hafidilasad/blog/blob/main/routes/web.php): `routes/web.php`
- [Public pages](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/PageController.php): `app/Http/Controllers/PageController.php`
- [Public views](https://github.com/hafidilasad/blog/blob/main/resources/views/front/index.blade.php): `resources/views/front/index.blade.php`

### Blog content

- [Post management](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/PostController.php): `app/Http/Controllers/PostController.php`
- [Category pages](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/CategoryController.php): `app/Http/Controllers/CategoryController.php`
- [Author pages](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/AuthorController.php): `app/Http/Controllers/AuthorController.php`
- [Author views](https://github.com/hafidilasad/blog/blob/main/resources/views/back/posts/index.blade.php): `resources/views/back/posts/index.blade.php`
- [Post model](https://github.com/hafidilasad/blog/blob/main/app/Models/Post.php): `app/Models/Post.php`
- [Category model](https://github.com/hafidilasad/blog/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Post observer](https://github.com/hafidilasad/blog/blob/main/app/Observers/PostObserver.php): `app/Observers/PostObserver.php`

### Administration

- [Admin management](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/Admin/AdminController.php): `app/Http/Controllers/Admin/AdminController.php`
- [Admin views](https://github.com/hafidilasad/blog/blob/main/resources/views/admin/dashboard.blade.php): `resources/views/admin/dashboard.blade.php`
- [Settings model](https://github.com/hafidilasad/blog/blob/main/app/Models/Setting.php): `app/Models/Setting.php`

### Identity and access

- [Authentication](https://github.com/hafidilasad/blog/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Auth views](https://github.com/hafidilasad/blog/blob/main/resources/views/auth/register.blade.php): `resources/views/auth/register.blade.php`
- [Role access](https://github.com/hafidilasad/blog/blob/main/app/Models/HasRoles.php): `app/Models/HasRoles.php`
- [User model](https://github.com/hafidilasad/blog/blob/main/app/Models/User.php): `app/Models/User.php`

### Other components

- **Visitor**
- **Author**
- **Administrator**
- **Database**

## Connections

- Visitor → Route provider: requests pages
- Author → Route provider: submits requests
- Administrator → Route provider: manages site
- Route provider → Web routes: loads routes
- Web routes → Public pages
- Web routes → Post management
- Web routes → Category pages
- Web routes → Author pages
- Public pages → Public views: renders pages
- Post management → Post model: creates and updates
- Post management → Category model: loads categories
- Post management → Author views: renders views
- Category pages → Category model
- Author pages → User model
- Post model → Post observer: observes changes
- Administrator → Admin management: administers data
- Admin management → Admin views: renders admin
- Admin management → Settings model
- Web routes → Authentication
- Authentication → Auth views: renders registration
- Authentication → User model: creates user
- User model → Role access: uses role traits
- Post model → Database: persists content
- Category model → Database: persists categories
- User model → Database: persists accounts
- Settings model → Database: persists settings
