Skip to content

Commit

Permalink
add support to laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
rupadana committed Mar 16, 2024
1 parent 68c2bb5 commit 1a00a2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"php": "^8.1",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.15.0",
"illuminate/contracts": "^10.0",
"illuminate/contracts": "^10.0|^11.0",
"guava/filament-icon-picker": "^2.0"
},
"require-dev": {
Expand Down
3 changes: 2 additions & 1 deletion src/FilamentAnnouncePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Filament\Contracts\Plugin;
use Filament\Panel;
use Filament\View\PanelsRenderHook;
use Illuminate\Support\Facades\Blade;
use Livewire\Livewire;
use Rupadana\FilamentAnnounce\Components\Announcement;
Expand All @@ -21,7 +22,7 @@ public function register(Panel $panel): void
{
$panel
->renderHook(
'panels::body.start',
PanelsRenderHook::BODY_START,
fn (): string => Blade::render('@livewire(\'filament-announce\')'),
)
->resources([
Expand Down
6 changes: 5 additions & 1 deletion src/Resources/AnnouncementResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ public static function getNavigationGroup(): ?string

public static function canAccess(): bool
{
return auth()->user()->hasRole(config('filament-announce.can_access.role') ?? []);
if (method_exists(auth()->user(), 'hasRole')) {
return auth()->user()->hasRole(config('filament-announce.can_access.role') ?? []);
}

return true;
}

public static function getNavigationSort(): ?int
Expand Down

0 comments on commit 1a00a2c

Please sign in to comment.