feat: initial project setup with Laravel 12 and Filament v4

This commit is contained in:
SajjadMahmoody
2026-04-03 17:25:17 +03:30
parent eca5d74b36
commit 09ee1cb743
324 changed files with 78304 additions and 23 deletions
+48
View File
@@ -0,0 +1,48 @@
<?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\Visit;
use App\Observers\SyncObserver;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Support\Enums\Alignment;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void {}
public function boot(): void
{
$observer = new SyncObserver();
Patient::observe($observer);
Doctor::observe($observer);
Treatment::observe($observer);
Medication::observe($observer);
PaymentType::observe($observer);
SurgeryCenter::observe($observer);
PatientIllness::observe($observer);
Prescription::observe($observer);
SurgeryAppointment::observe($observer);
Visit::observe($observer);
DeleteAction::configureUsing(function (DeleteAction $action): void {
$action->modalAlignment(Alignment::Start);
});
DeleteBulkAction::configureUsing(function (DeleteBulkAction $action): void {
$action->modalAlignment(Alignment::Start);
});
}
}
@@ -0,0 +1,129 @@
<?php
namespace App\Providers\Filament;
use App\Filament\Pages\Auth\Login;
use App\Http\Middleware\SetLocale;
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
use Filament\Actions\Action;
use Filament\Http\Middleware\Authenticate;
use Filament\View\PanelsRenderHook;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Navigation\NavigationGroup;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Support\Enums\Width;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
class AdminPanelProvider extends PanelProvider
{
public function boot(): void
{
\Filament\Support\Facades\FilamentAsset::register([
\Filament\Support\Assets\Js::make('audio-speed', asset('js/audio-speed.js')),
]);
}
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login(Login::class)
->colors([
'primary' => Color::Blue,
'orange' => Color::Orange,
])
->brandLogo(function () {
$key = app()->getLocale() === 'fa' ? 'listlogo_per.png' : 'listlogo_eng.png';
$attachment = \Illuminate\Support\Facades\Cache::remember(
'brand_logo_' . $key,
now()->addHours(24),
fn () => \App\Models\OsurgInitial::where('init_parameter', $key)->value('attachment')
);
return $attachment ? asset('storage/' . $attachment) : null;
})
->brandLogoHeight('1.75rem')
->brandName('')
->favicon(asset('favicon.svg'))
->font('Vazirmatn', url: \Illuminate\Support\Facades\Vite::asset('resources/css/vazirmatn.css'), provider: \Filament\FontProviders\LocalFontProvider::class)
->renderHook(
PanelsRenderHook::TOPBAR_LOGO_AFTER,
fn (): string => view('components.persian-datetime')->render(),
)
->renderHook(
PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
fn (): string => \Blade::render('@livewire(\'settings-dropdown\')'),
)
->renderHook(
PanelsRenderHook::BODY_END,
fn (): string => <<<'HTML'
<script>
(function () {
var speeds = [0.5, 1, 1.5, 2];
document.addEventListener('click', function (e) {
var btn = e.target.closest('.filepond--media-player-button-playbackrate');
if (!btn) return;
var item = btn.closest('.filepond--item, .filepond--root');
if (!item) return;
var media = item.querySelector('audio, video');
if (!media) return;
var current = media.playbackRate || 1;
var idx = speeds.indexOf(current);
var next = speeds[(idx + 1) % speeds.length];
media.playbackRate = next;
btn.textContent = next + 'x';
});
})();
</script>
HTML,
)
->userMenuItems([
Action::make('switch_language')
->label(fn () => app()->getLocale() === 'fa' ? 'English' : 'فارسی')
->icon('heroicon-o-language')
->url(fn () => route('locale.switch', app()->getLocale() === 'fa' ? 'en' : 'fa')),
])
->navigationGroups([
NavigationGroup::make('بیماران و ویزیت'),
NavigationGroup::make('بیماری‌ها و روش‌های درمان'),
NavigationGroup::make('اطلاعات کلینیک'),
NavigationGroup::make('تنظیمات'),
])
->sidebarFullyCollapsibleOnDesktop()
->maxContentWidth(Width::Full)
->viteTheme('resources/css/filament/admin/theme.css')
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
->plugins([
FilamentShieldPlugin::make(),
])
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
->pages([])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
->widgets([])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
SetLocale::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
@@ -0,0 +1,64 @@
<?php
namespace App\Providers;
use Native\Desktop\Facades\AutoUpdater;
use Native\Desktop\Facades\Menu;
use Native\Desktop\Facades\Window;
use Native\Desktop\Contracts\ProvidesPhpIni;
class NativeAppServiceProvider implements ProvidesPhpIni
{
public function boot(): void
{
$this->registerMenu();
Window::open()
->title('مطب پنل')
->width(1280)
->height(800)
->maximized()
->rememberState();
AutoUpdater::checkForUpdates();
}
protected function registerMenu(): void
{
Menu::create(
Menu::make(
Menu::reload('بارگذاری مجدد'),
Menu::separator(),
Menu::quit('خروج'),
)->label('فایل'),
Menu::make(
Menu::undo('بازگردانی'),
Menu::redo('از نو'),
Menu::separator(),
Menu::cut('برش'),
Menu::copy('کپی'),
Menu::paste('چسباندن'),
)->label('ویرایش'),
Menu::make(
Menu::fullscreen('تمام صفحه'),
Menu::separator(),
Menu::devTools('ابزار توسعه‌دهنده'),
)->label('نمایش'),
Menu::make(
Menu::minimize('کمینه'),
Menu::close('بستن'),
)->label('پنجره'),
);
}
public function phpIni(): array
{
return [
'memory_limit' => '512M',
'post_max_size' => '50M',
'upload_max_filesize' => '50M',
];
}
}