2026-01-01 18:21:31 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Providers\Filament;
|
|
|
|
|
|
|
|
|
|
|
|
use Filament\Http\Middleware\Authenticate;
|
|
|
|
|
|
use Filament\Http\Middleware\AuthenticateSession;
|
|
|
|
|
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
|
|
|
|
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
|
|
|
|
|
use Filament\Pages\Dashboard;
|
|
|
|
|
|
use Filament\Panel;
|
|
|
|
|
|
use Filament\PanelProvider;
|
|
|
|
|
|
use Filament\Support\Colors\Color;
|
2026-01-06 13:26:55 +01:00
|
|
|
|
use Filament\Support\Facades\FilamentView;
|
|
|
|
|
|
use Filament\View\PanelsRenderHook;
|
2026-01-01 18:21:31 +00:00
|
|
|
|
use Filament\Widgets\AccountWidget;
|
|
|
|
|
|
use Filament\Widgets\FilamentInfoWidget;
|
|
|
|
|
|
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 panel(Panel $panel): Panel
|
|
|
|
|
|
{
|
|
|
|
|
|
return $panel
|
|
|
|
|
|
->default()
|
2026-01-07 16:11:33 +00:00
|
|
|
|
->sidebarCollapsibleOnDesktop()
|
2026-01-01 18:21:31 +00:00
|
|
|
|
->id('admin')
|
|
|
|
|
|
->path('admin')
|
|
|
|
|
|
->login()
|
|
|
|
|
|
->colors([
|
2026-01-02 13:58:06 +00:00
|
|
|
|
'primary' => Color::Blue,
|
2026-01-01 18:21:31 +00:00
|
|
|
|
])
|
2026-01-24 11:18:01 +00:00
|
|
|
|
->resources([
|
|
|
|
|
|
\App\Filament\Resources\Entries\EntryResource::class,
|
|
|
|
|
|
\App\Filament\Resources\Media\MediaResource::class,
|
|
|
|
|
|
\App\Filament\Resources\Categroys\CategroyResource::class,
|
|
|
|
|
|
])
|
2026-02-08 18:04:18 +01:00
|
|
|
|
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
|
2026-01-01 18:21:31 +00:00
|
|
|
|
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
|
|
|
|
|
|
->pages([
|
|
|
|
|
|
Dashboard::class,
|
|
|
|
|
|
])
|
|
|
|
|
|
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
|
|
|
|
|
->widgets([
|
|
|
|
|
|
AccountWidget::class,
|
|
|
|
|
|
FilamentInfoWidget::class,
|
|
|
|
|
|
])
|
|
|
|
|
|
->middleware([
|
|
|
|
|
|
EncryptCookies::class,
|
|
|
|
|
|
AddQueuedCookiesToResponse::class,
|
|
|
|
|
|
StartSession::class,
|
|
|
|
|
|
AuthenticateSession::class,
|
|
|
|
|
|
ShareErrorsFromSession::class,
|
|
|
|
|
|
VerifyCsrfToken::class,
|
|
|
|
|
|
SubstituteBindings::class,
|
|
|
|
|
|
DisableBladeIconComponents::class,
|
|
|
|
|
|
DispatchServingFilamentEvent::class,
|
|
|
|
|
|
])
|
|
|
|
|
|
->authMiddleware([
|
|
|
|
|
|
Authenticate::class,
|
|
|
|
|
|
]);
|
|
|
|
|
|
}
|
2026-01-06 13:26:55 +01:00
|
|
|
|
|
|
|
|
|
|
public function boot(): void
|
|
|
|
|
|
{
|
|
|
|
|
|
FilamentView::registerRenderHook(
|
|
|
|
|
|
PanelsRenderHook::BODY_END,
|
2026-01-07 16:11:33 +00:00
|
|
|
|
fn(): string => \Illuminate\Support\Facades\Blade::render('@vite("resources/js/app.js")'),
|
2026-01-06 13:26:55 +01:00
|
|
|
|
);
|
2026-02-14 17:49:01 +01:00
|
|
|
|
|
|
|
|
|
|
FilamentView::registerRenderHook(
|
|
|
|
|
|
PanelsRenderHook::BODY_END,
|
|
|
|
|
|
function (): string {
|
|
|
|
|
|
return '
|
|
|
|
|
|
<script>
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
if (window.Echo) {
|
|
|
|
|
|
console.log("Setting up Filament Reverb notifications...");
|
|
|
|
|
|
console.log("Available globals:", {
|
|
|
|
|
|
FilamentNotification: typeof FilamentNotification,
|
|
|
|
|
|
Livewire: typeof window.Livewire,
|
|
|
|
|
|
filament: typeof window.filament
|
|
|
|
|
|
});
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
// Listen for preview site built events
|
|
|
|
|
|
window.Echo.channel("filament-notifications")
|
|
|
|
|
|
.listen("preview-site.built", function(event) {
|
|
|
|
|
|
console.log("🎉 Received preview site built event:", event);
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
// Use Filament v4 notification system
|
|
|
|
|
|
if (typeof FilamentNotification !== "undefined") {
|
|
|
|
|
|
new FilamentNotification()
|
|
|
|
|
|
.title(event.message)
|
|
|
|
|
|
.success()
|
|
|
|
|
|
.duration(5000)
|
|
|
|
|
|
.send();
|
|
|
|
|
|
console.log("✅ Sent via FilamentNotification v4");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.warn("FilamentNotification not available");
|
|
|
|
|
|
// Fallback notification
|
|
|
|
|
|
const notification = document.createElement("div");
|
|
|
|
|
|
notification.style.cssText = `
|
|
|
|
|
|
position: fixed !important;
|
|
|
|
|
|
top: 20px !important;
|
|
|
|
|
|
right: 20px !important;
|
|
|
|
|
|
z-index: 999999 !important;
|
|
|
|
|
|
background: #10b981 !important;
|
|
|
|
|
|
color: white !important;
|
|
|
|
|
|
padding: 16px 20px !important;
|
|
|
|
|
|
border-radius: 8px !important;
|
|
|
|
|
|
box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
|
|
|
|
|
|
font-family: system-ui, -apple-system, sans-serif !important;
|
|
|
|
|
|
font-size: 14px !important;
|
|
|
|
|
|
font-weight: 500 !important;
|
|
|
|
|
|
max-width: 350px !important;
|
|
|
|
|
|
display: block !important;
|
|
|
|
|
|
opacity: 1 !important;
|
|
|
|
|
|
`;
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
notification.innerHTML = `
|
|
|
|
|
|
<div style="display: flex; align-items: center; justify-content: space-between;">
|
|
|
|
|
|
<div style="margin-right: 15px;">
|
|
|
|
|
|
✓ ${event.message}
|
|
|
|
|
|
</div>
|
2026-02-15 10:37:43 +00:00
|
|
|
|
<button onclick="this.parentElement.parentElement.remove()"
|
2026-02-14 17:49:01 +01:00
|
|
|
|
style="background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0;">
|
|
|
|
|
|
×
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
`;
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
document.body.appendChild(notification);
|
|
|
|
|
|
console.log("✅ Created fallback notification");
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
// Auto-remove after 5 seconds
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if (notification.parentNode) {
|
|
|
|
|
|
notification.remove();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.listen(".preview-site.built", function(event) {
|
|
|
|
|
|
console.log("🔄 Also listening with dot prefix (the working one):", event);
|
|
|
|
|
|
console.log("message:", event.message);
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
// Use Filament v4 notification system
|
|
|
|
|
|
if (typeof FilamentNotification !== "undefined") {
|
|
|
|
|
|
new FilamentNotification()
|
|
|
|
|
|
.title(event.message)
|
|
|
|
|
|
.success()
|
|
|
|
|
|
.duration(5000)
|
|
|
|
|
|
.send();
|
|
|
|
|
|
console.log("✅ Sent via FilamentNotification v4 (from dot prefix)");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.warn("FilamentNotification not available, creating fallback");
|
|
|
|
|
|
// Fallback notification
|
|
|
|
|
|
const notification = document.createElement("div");
|
|
|
|
|
|
notification.style.cssText = `
|
|
|
|
|
|
position: fixed !important;
|
|
|
|
|
|
top: 20px !important;
|
|
|
|
|
|
right: 20px !important;
|
|
|
|
|
|
z-index: 999999 !important;
|
|
|
|
|
|
background: #3b82f6 !important;
|
|
|
|
|
|
color: white !important;
|
|
|
|
|
|
padding: 16px 20px !important;
|
|
|
|
|
|
border-radius: 8px !important;
|
|
|
|
|
|
box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
|
|
|
|
|
|
font-family: system-ui, -apple-system, sans-serif !important;
|
|
|
|
|
|
font-size: 14px !important;
|
|
|
|
|
|
font-weight: 500 !important;
|
|
|
|
|
|
max-width: 350px !important;
|
|
|
|
|
|
display: block !important;
|
|
|
|
|
|
opacity: 1 !important;
|
|
|
|
|
|
`;
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
notification.innerHTML = `
|
|
|
|
|
|
<div style="display: flex; align-items: center; justify-content: space-between;">
|
|
|
|
|
|
<div style="margin-right: 15px;">
|
|
|
|
|
|
🔄 ${event.message}
|
|
|
|
|
|
</div>
|
2026-02-15 10:37:43 +00:00
|
|
|
|
<button onclick="this.parentElement.parentElement.remove()"
|
2026-02-14 17:49:01 +01:00
|
|
|
|
style="background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0;">
|
|
|
|
|
|
×
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
`;
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
document.body.appendChild(notification);
|
|
|
|
|
|
console.log("✅ Created dot prefix fallback notification");
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
// Auto-remove after 5 seconds
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if (notification.parentNode) {
|
|
|
|
|
|
notification.remove();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-02-15 10:37:43 +00:00
|
|
|
|
|
2026-02-14 17:49:01 +01:00
|
|
|
|
console.log("✅ Event listeners set up for filament-notifications channel");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.error("❌ Echo is not available for Filament notifications");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>';
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
2026-01-06 13:26:55 +01:00
|
|
|
|
}
|
2026-01-01 18:21:31 +00:00
|
|
|
|
}
|