matab-panel/app/Providers/AppServiceProvider.php

76 lines
2.6 KiB
PHP

<?php
namespace App\Providers;
use App\Models\Doctor;
use App\Models\Medication;
use App\Models\Patient;
use App\Models\PatientIllness;
use App\Models\PaymentType;
use App\Models\Prescription;
use App\Models\SurgeryAppointment;
use App\Models\SurgeryCenter;
use App\Models\Treatment;
use App\Models\LabTest;
use App\Models\User;
use App\Models\Visit;
use Spatie\Permission\Models\Role;
use App\Observers\PatientIllnessObserver;
use App\Observers\PatientObserver;
use App\Observers\SyncObserver;
use App\Observers\VisitObserver;
use App\Filament\Widgets\VisitStatsWidget;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Support\Enums\Alignment;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
use Livewire\Livewire;
class AppServiceProvider extends ServiceProvider
{
public function register(): void {}
public function boot(): void
{
if (app()->runningInConsole() === false && isset($_SERVER['HTTP_HOST'])) {
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http';
$root = "{$scheme}://{$_SERVER['HTTP_HOST']}";
URL::forceRootUrl($root);
config([
'app.url' => $root,
'filesystems.disks.public.url' => $root . '/storage',
]);
}
Livewire::component('app.filament.widgets.visit-stats-widget', VisitStatsWidget::class);
Livewire::component('patient-media-player', \App\Livewire\PatientMediaPlayer::class);
Livewire::component('expandable-text', \App\Livewire\ExpandableText::class);
$observer = new SyncObserver();
Patient::observe($observer);
Patient::observe(PatientObserver::class);
Doctor::observe($observer);
LabTest::observe($observer);
Treatment::observe($observer);
Medication::observe($observer);
PaymentType::observe($observer);
SurgeryCenter::observe($observer);
PatientIllness::observe($observer);
PatientIllness::observe(PatientIllnessObserver::class);
Prescription::observe($observer);
SurgeryAppointment::observe($observer);
Visit::observe($observer);
Visit::observe(VisitObserver::class);
User::observe($observer);
Role::observe($observer);
DeleteAction::configureUsing(function (DeleteAction $action): void {
$action->modalAlignment(Alignment::Start);
});
DeleteBulkAction::configureUsing(function (DeleteBulkAction $action): void {
$action->modalAlignment(Alignment::Start);
});
}
}