diff --git a/src/Support/Page.php b/src/Support/Page.php index 687bf4c..edf1dc5 100644 --- a/src/Support/Page.php +++ b/src/Support/Page.php @@ -2,34 +2,36 @@ namespace Pboivin\FilamentPeek\Support; -use Filament\Pages\Page as FilamentPage; +use Livewire\Component; use Pboivin\FilamentPeek\Exceptions\PreviewModalException; class Page { - public static function supportsPreviewModal(FilamentPage $page): bool + public static function supportsPreviewModal(Component $page): bool { return method_exists($page, 'openPreviewModal'); } - public static function ensurePreviewModalSupport(FilamentPage $page): void + public static function ensurePreviewModalSupport(Component $page): void { if (! static::supportsPreviewModal($page)) { - throw new PreviewModalException('Page class is missing the `HasPreviewModal` trait.'); + $basename = class_basename($page); + throw new PreviewModalException("`{$basename}` class is missing the `HasPreviewModal` trait."); } } - public static function supportsBuilderPreview(FilamentPage $page): bool + public static function supportsBuilderPreview(Component $page): bool { return static::supportsPreviewModal($page) && method_exists($page, 'openPreviewModalForBuidler'); } - public static function ensureBuilderPreviewSupport(FilamentPage $page): void + public static function ensureBuilderPreviewSupport(Component $page): void { static::ensurePreviewModalSupport($page); if (! static::supportsBuilderPreview($page)) { - throw new PreviewModalException('Page class is missing the `HasBuilderPreview` trait.'); + $basename = class_basename($page); + throw new PreviewModalException("`{$basename}` class is missing the `HasBuilderPreview` trait."); } } }