# achyutkneupane/laravel-helpers architecture

> Architecture diagram of the GitHub repository achyutkneupane/laravel-helpers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/achyutkneupane/laravel-helpers
- Repository: https://github.com/achyutkneupane/laravel-helpers

## Overview

##### Main Components

a. Core Package Components:
- Traits Module
- Rules Module
- Helpers Module
- Pagination Module
- Controller Module
- Scope Module

b. External Dependencies:
- Laravel Framework
- eloquent-sluggable package
- laravel-medialibrary package
- LaravelUserLogs package

**┌─ Laravel Application (Host) ─────────────────────────────────┐**

- ┌─ Laravel Helpers Package ──────────────────────────┐     │

- ┌─ Core Features ─────────────────────────┐      │     │

- ┌─ Traits ─────────┐                  │      │     │
- HasTheSlug     │                  │      │     │
- HasTheMedia    │                  │      │     │
- CanBeApproved  │                  │      │     │
- CanBeInactive  │                  │      │     │
- ┘                   │      │     │

- ┌─ Rules ──────────┐                  │      │     │
- LatitudeRule   │                  │      │     │
- LongitudeRule  │                  │      │     │
- ┘                   │      │     │

- ┌─ Helpers ────────┐                  │      │     │
- Nepali Helpers │                  │      │     │
- General Helpers│                  │      │     │
- ┘                   │      │     │
- ┘      │     │

- ┌─ External Dependencies ──────────────────┐      │     │
- eloquent-sluggable                    │      │     │
- laravel-medialibrary                  │      │     │
- LaravelUserLogs                       │      │     │
- ┘       │     │
- ┘     │
- ┘

##### Important Elements to Highlight

a. Integration Points:
- How traits can be used in Laravel models
- Demonstrate helper function accessibility
- Rule integration with Laravel validation

b. Data Flow:
- How traits modify model behavior
- How helpers transform data
- Validation rule processing

##### Specific Implementation Details

- How HasTheDashboardTraits combines multiple traits
- Demonstrate media conversion flow in HasTheMedia
- Slug generation process
- Nepali number conversion workflow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Host["Laravel Application Host"]
        subgraph Package["Laravel Helpers Package"]
            subgraph Core["Core Features"]
                subgraph Traits["Traits Module"]
                    HasSlug["HasTheSlug"]:::trait
                    HasMedia["HasTheMedia"]:::trait
                    CanApprove["CanBeApproved"]:::trait
                    CanInactive["CanBeInactive"]:::trait
                    DashTraits["HasTheDashboardTraits"]:::trait
                end

                subgraph Rules["Rules Module"]
                    LatRule["LatitudeRule"]:::rule
                    LongRule["LongitudeRule"]:::rule
                    MatchPass["MatchOldPassword"]:::rule
                end

                subgraph Helpers["Helpers Module"]
                    NepHelp["Nepali Helpers"]:::helper
                    GenHelp["General Helpers"]:::helper
                end

                subgraph Other["Additional Components"]
                    Pag["Custom Paginator"]:::component
                    ApiBase["API Base Controller"]:::component
                    Scope["Scopes"]:::component
                end
            end

            Provider["Laravel Helper Provider"]:::provider
        end

        subgraph Deps["External Dependencies"]
            Sluggable["eloquent-sluggable"]:::external
            MediaLib["laravel-medialibrary"]:::external
            UserLogs["LaravelUserLogs"]:::external
        end
    end

    %% Relationships
    Provider --> Core
    HasSlug --> Sluggable
    HasMedia --> MediaLib
    DashTraits --> HasSlug
    DashTraits --> HasMedia
    DashTraits --> CanApprove
    DashTraits --> CanInactive

    %% Click Events
    click HasSlug "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Traits/HasTheSlug.php"
    click HasMedia "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Traits/HasTheMedia.php"
    click CanApprove "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Traits/CanBeApproved.php"
    click CanInactive "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Traits/CanBeInactive.php"
    click DashTraits "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Traits/HasTheDashboardTraits.php"
    click LatRule "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Rules/LatitudeRule.php"
    click LongRule "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Rules/LongitudeRule.php"
    click MatchPass "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Rules/MatchOldPassword.php"
    click NepHelp "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/nepali-helpers.php"
    click GenHelp "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/helpers.php"
    click Pag "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Pagination/CustomPaginator.php"
    click ApiBase "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/Controller/ApiBaseController.php"
    click Scope "https://github.com/achyutkneupane/laravel-helpers/tree/master/src/Scope"
    click Provider "https://github.com/achyutkneupane/laravel-helpers/blob/master/src/LaravelHelperProvider.php"
    click Traits "https://github.com/achyutkneupane/laravel-helpers/tree/master/src/Traits"
    click Rules "https://github.com/achyutkneupane/laravel-helpers/tree/master/src/Rules"

    %% Styling
    classDef trait fill:#a8d5ff,stroke:#333
    classDef rule fill:#ffe6a8,stroke:#333
    classDef helper fill:#a8ffc1,stroke:#333
    classDef component fill:#e6a8ff,stroke:#333
    classDef external fill:#d3d3d3,stroke:#333
    classDef provider fill:#ffa8a8,stroke:#333

    %% Legend
    subgraph Legend
        L1["Trait"]:::trait
        L2["Rule"]:::rule
        L3["Helper"]:::helper
        L4["Component"]:::component
        L5["External Dependency"]:::external
        L6["Provider"]:::provider
    end
```
