azaharizaman / laravel-backoffice
A Laravel package for managing hierarchical company structures, offices, departments, staff, and units
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/azaharizaman/laravel-backoffice
Requires
- php: ^8.2
- illuminate/console: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0|^10.0
- php-coveralls/php-coveralls: ^0.1.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0|^11.0
README
A comprehensive Laravel package for managing hierarchical company structures, offices, departments, staff, and organizational units. This package provides a complete backend solution for complex organizational management without any UI components.
Features
Hierarchical Company Structure
- Parent-Child Companies: Support for multi-level company hierarchies
- Office Management: Physical office structures with hierarchical relationships
- Department Management: Logical department hierarchies
- Staff Management: Employee assignment to offices and/or departments
- Unit Management: Logical staff groupings with unit group organization
Key Capabilities
- Multi-Hierarchy Support: Both physical (offices) and logical (departments) hierarchies
- Flexible Staff Assignment: Staff can belong to offices, departments, or both
- Unit Organization: Staff can belong to multiple units within unit groups
- Organizational Charts: Comprehensive reporting line management with chart generation
- Export Capabilities: JSON, CSV, and DOT (Graphviz) export formats
- Office Types: Configurable office type categorization
- Model Factories: 🆕 Comprehensive factories for all models with rich states for testing
- Comprehensive Policies: Built-in authorization policies
- Observer Patterns: Automatic event handling for data changes
- Console Commands: Management utilities via Artisan commands
Requirements
- PHP 8.2+
- Laravel 11.0+ or 12.0+
Installation
You can install the package via composer:
composer require azaharizaman/backoffice
Publish and run the migrations:
php artisan vendor:publish --provider="AzahariZaman\BackOffice\BackOfficeServiceProvider" --tag="backoffice-migrations" php artisan migrate
Optionally, you can publish the config file:
php artisan vendor:publish --provider="AzahariZaman\BackOffice\BackOfficeServiceProvider" --tag="backoffice-config"
Quick Start
use AzahariZaman\BackOffice\Models\{Company, Office, Staff}; use AzahariZaman\BackOffice\Helpers\OrganizationalChart; // Create organizational structure using factories $company = Company::factory()->create(['name' => 'Acme Corp']); $office = Office::factory()->for($company)->create(); // Create hierarchical staff structure using factories $ceo = Staff::factory()->ceo()->inOffice($office)->create(); $manager = Staff::factory()->manager()->withSupervisor($ceo)->create(); $employee = Staff::factory()->withSupervisor($manager)->create(); // Generate organizational chart $chart = OrganizationalChart::forCompany($company); $stats = OrganizationalChart::statistics($company); // Export chart data $csvData = OrganizationalChart::export($company, 'csv');
See the documentation for detailed usage instructions.
Documentation
- Installation Guide
- Configuration
- Models & Relationships
- Model Factories 🆕
- Organizational Chart & Reporting Lines
- Traits & Behaviors
- Policies & Authorization
- Console Commands
- API Reference
- Examples
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.