Files
Toiminnanohjaus/app/Modules/Reports/Infrastructure/Providers/ReportsServiceProvider.php
T
petriandClaude Sonnet 5.5 8079c272d2 Add the expense reimbursements report
The expenses employees paid themselves in a period, by person with
kilometres and amounts, printable and as CSV for payroll.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-25 08:46:22 +02:00

55 lines
2.1 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\ReportExpenses;
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\Application\Contracts\ReportSales;
use App\Modules\Reports\Infrastructure\Adapters\CatalogForReports;
use App\Modules\Reports\Infrastructure\Adapters\ExpensesForReports;
use App\Modules\Reports\Infrastructure\Adapters\HoursForReports;
use App\Modules\Reports\Infrastructure\Adapters\JobsForReports;
use App\Modules\Reports\Infrastructure\Adapters\PeopleForReports;
use App\Modules\Reports\Infrastructure\Adapters\SalesForReports;
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,
ReportSales::class => SalesForReports::class,
ReportExpenses::class => ExpensesForReports::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());
}
}