Everyone sees their open tasks on an agenda, their open jobs, this week's hours and quick links. Admin and management also get a lazily loaded management panel: things to do, the month so far against the previous month, jobs and late work, and everyone's workload. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Dashboard\Infrastructure\Providers;
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Dashboard\Application\Contracts\DashboardAdmin;
|
|
use App\Modules\Dashboard\Application\Contracts\DashboardFigures;
|
|
use App\Modules\Dashboard\Application\Contracts\DashboardTime;
|
|
use App\Modules\Dashboard\Application\Contracts\DashboardWork;
|
|
use App\Modules\Dashboard\Infrastructure\Adapters\AdminForDashboard;
|
|
use App\Modules\Dashboard\Infrastructure\Adapters\FiguresForDashboard;
|
|
use App\Modules\Dashboard\Infrastructure\Adapters\TimeForDashboard;
|
|
use App\Modules\Dashboard\Infrastructure\Adapters\WorkForDashboard;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Livewire\Livewire;
|
|
|
|
/**
|
|
* Wires the Dashboard module (the home page) into Laravel: the ports to
|
|
* the other modules, the home route, the `dashboard::` Livewire namespace
|
|
* and the `dashboard.management` ability.
|
|
*/
|
|
class DashboardServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* @var array<class-string, class-string>
|
|
*/
|
|
public array $bindings = [
|
|
DashboardWork::class => WorkForDashboard::class,
|
|
DashboardTime::class => TimeForDashboard::class,
|
|
DashboardAdmin::class => AdminForDashboard::class,
|
|
DashboardFigures::class => FiguresForDashboard::class,
|
|
];
|
|
|
|
public function boot(): void
|
|
{
|
|
$presentationPath = dirname(__DIR__, 2).'/Presentation';
|
|
|
|
Livewire::addNamespace('dashboard', viewPath: $presentationPath.'/Livewire');
|
|
|
|
if (! $this->app->routesAreCached()) {
|
|
$this->loadRoutesFrom($presentationPath.'/Routes/web.php');
|
|
}
|
|
|
|
// The management panel of the home page: admin and management.
|
|
Gate::define('dashboard.management', fn (User $user): bool => $user->role->seesAllMoney());
|
|
}
|
|
}
|