# amethdiamanka/crud-role-permission-spatie architecture

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

- Interactive diagram: https://gitdiagram.com/amethdiamanka/crud-role-permission-spatie
- Repository: https://github.com/amethdiamanka/crud-role-permission-spatie

## Overview

Diamanka is a Laravel package for managing Spatie roles and permissions through authenticated web pages. The user workflow is routed requests to role or permission controllers, which validate and mutate Spatie models, then return listing or form views. The README documents creation and listing for both domain types; the sampled controllers also implement edit, update, and deletion. The graph reflects routes, controller behavior, and provider wiring shown in excerpts; database persistence is delegated to Spatie and Laravel, and its internal implementation is not sampled.

Main entry points: [`src/Http/Controllers/RoleController.php`](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/RoleController.php) (Role operations), [`src/Http/Controllers/PermissionController.php`](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/PermissionController.php) (Permission operations), [`routes/web.php`](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/routes/web.php) (Web routes), [`src/Http/Controllers/Controller.php`](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/Controller.php) (Controller base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Routing and setup"]
  node_routes["Web routes<br/>[web.php]"]
  node_provider["Service provider"]
  node_base["Controller base<br/>[Controller.php]"]
  node_spatie_models["Spatie role and permission models"]
end

subgraph group_permissions["Permission management"]
  node_permission_controller["Permission operations"]
  node_permission_store[("Permission storage")]
end

subgraph group_roles["Role management"]
  node_role_controller["Role operations<br/>[RoleController.php]"]
  node_role_store[("Role storage")]
  node_permission_cache[("Permission cache")]
end

subgraph group_presentation["Management views"]
  node_permission_views["Permission forms and list"]
  node_role_views["Role forms and list"]
end

node_user(("Authenticated user"))

node_user -->|"requests"| node_routes
node_provider -->|"loads"| node_routes
node_routes -->|"dispatches"| node_permission_controller
node_routes -->|"dispatches"| node_role_controller
node_permission_controller -->|"extends"| node_base
node_role_controller -->|"extends"| node_base
node_permission_controller -->|"renders"| node_permission_views
node_role_controller -->|"renders"| node_role_views
node_permission_controller -->|"queries and mutates"| node_spatie_models
node_role_controller -->|"queries and mutates"| node_spatie_models
node_spatie_models -.->|"persists permissions"| node_permission_store
node_spatie_models -.->|"persists roles"| node_role_store
node_role_controller -->|"clears cache"| node_permission_cache

click node_routes "https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/routes/web.php"
click node_provider "https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Providers/DiamankaServiceProvider.php"
click node_base "https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/Controller.php"
click node_permission_controller "https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/PermissionController.php"
click node_permission_views "https://github.com/amethdiamanka/crud-role-permission-spatie/tree/main/resources/views/permissions"
click node_role_controller "https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/RoleController.php"
click node_role_views "https://github.com/amethdiamanka/crud-role-permission-spatie/tree/main/resources/views/roles"

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_routes,node_provider,node_base,node_spatie_models,node_user toneBlue
class node_permission_controller,node_permission_store toneAmber
class node_role_controller,node_role_store,node_permission_cache toneMint
class node_permission_views,node_role_views toneRose
```

## Components

### Routing and setup

- [Web routes](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/routes/web.php): `routes/web.php`
- [Service provider](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Providers/DiamankaServiceProvider.php): `src/Providers/DiamankaServiceProvider.php`
- [Controller base](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/Controller.php): `src/Http/Controllers/Controller.php`
- **Spatie role and permission models**

### Permission management

- [Permission operations](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/PermissionController.php): `src/Http/Controllers/PermissionController.php`
- **Permission storage**

### Role management

- [Role operations](https://github.com/amethdiamanka/crud-role-permission-spatie/blob/main/src/Http/Controllers/RoleController.php): `src/Http/Controllers/RoleController.php`
- **Role storage**
- **Permission cache**

### Management views

- [Permission forms and list](https://github.com/amethdiamanka/crud-role-permission-spatie/tree/main/resources/views/permissions): `resources/views/permissions`
- [Role forms and list](https://github.com/amethdiamanka/crud-role-permission-spatie/tree/main/resources/views/roles): `resources/views/roles`

### Other components

- **Authenticated user**

## Connections

- Authenticated user → Web routes: requests (evidence: `README.md`)
- Service provider → Web routes: loads (evidence: `src/Providers/DiamankaServiceProvider.php`)
- Web routes → Permission operations: dispatches (evidence: `routes/web.php`)
- Web routes → Role operations: dispatches (evidence: `routes/web.php`)
- Permission operations → Controller base: extends (evidence: `src/Http/Controllers/PermissionController.php`)
- Role operations → Controller base: extends (evidence: `src/Http/Controllers/RoleController.php`)
- Permission operations → Permission forms and list: renders (evidence: `src/Http/Controllers/PermissionController.php`)
- Role operations → Role forms and list: renders (evidence: `src/Http/Controllers/RoleController.php`)
- Permission operations → Spatie role and permission models: queries and mutates (evidence: `src/Http/Controllers/PermissionController.php`)
- Role operations → Spatie role and permission models: queries and mutates (evidence: `src/Http/Controllers/RoleController.php`)
- Spatie role and permission models → Permission storage: persists permissions
- Spatie role and permission models → Role storage: persists roles
- Role operations → Permission cache: clears cache (evidence: `src/Http/Controllers/RoleController.php`)
