Management's reports (spec 13) get their own module that reads the other modules through ports. The first report sums hours by person in a period, narrowed by service unit or customer, with breakdowns, a chart and CSV. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Reports\Infrastructure\Providers;
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Reports\Application\Contracts\ReportCatalog;
|
|
use App\Modules\Reports\Application\Contracts\ReportHours;
|
|
use App\Modules\Reports\Application\Contracts\ReportJobs;
|
|
use App\Modules\Reports\Application\Contracts\ReportPeople;
|
|
use App\Modules\Reports\Infrastructure\Adapters\CatalogForReports;
|
|
use App\Modules\Reports\Infrastructure\Adapters\HoursForReports;
|
|
use App\Modules\Reports\Infrastructure\Adapters\JobsForReports;
|
|
use App\Modules\Reports\Infrastructure\Adapters\PeopleForReports;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Livewire\Livewire;
|
|
|
|
/**
|
|
* Wires the Reports module (management's reports, spec 13) into Laravel:
|
|
* the ports to the other modules, routes, the `reports::` Livewire
|
|
* namespace and the `reports.view` ability.
|
|
*/
|
|
class ReportsServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* @var array<class-string, class-string>
|
|
*/
|
|
public array $bindings = [
|
|
ReportHours::class => HoursForReports::class,
|
|
ReportJobs::class => JobsForReports::class,
|
|
ReportCatalog::class => CatalogForReports::class,
|
|
ReportPeople::class => PeopleForReports::class,
|
|
];
|
|
|
|
public function boot(): void
|
|
{
|
|
$presentationPath = dirname(__DIR__, 2).'/Presentation';
|
|
|
|
Livewire::addNamespace('reports', viewPath: $presentationPath.'/Livewire');
|
|
|
|
if (! $this->app->routesAreCached()) {
|
|
$this->loadRoutesFrom($presentationPath.'/Routes/web.php');
|
|
}
|
|
|
|
// Reports are for admin and management (spec 2.4).
|
|
Gate::define('reports.view', fn (User $user): bool => $user->role->seesAllMoney());
|
|
}
|
|
}
|