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

v1.0.1 2025-10-31 12:55 UTC

This package is auto-updated.

Last update: 2025-10-31 15:35:17 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

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.