Skip to content

Commit 14c3440

Browse files
authored
Switch more places to use filament comment model config
1 parent 40bc3d5 commit 14c3440

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/Actions/CommentsAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ protected function setUp(): void
2929
->modalWidth(MaxWidth::Medium)
3030
->modalSubmitAction(false)
3131
->modalCancelAction(false)
32-
->visible(fn (): bool => auth()->user()->can('viewAny', FilamentComment::class));
32+
->visible(fn (): bool => auth()->user()->can('viewAny', config('filament-comments.comment_model'));
3333
}
3434
}

src/FilamentCommentsServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function packageBooted(): void
5555
{
5656
Livewire::component('comments', CommentsComponent::class);
5757

58-
Gate::policy(FilamentComment::class, config('filament-comments.model_policy', FilamentCommentPolicy::class));
58+
Gate::policy(config('filament-comments.comment_model'), config('filament-comments.model_policy', FilamentCommentPolicy::class));
5959

6060
FilamentAsset::register(
6161
$this->getAssets(),

src/Infolists/Components/CommentsEntry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ protected function setUp(): void
1313
{
1414
parent::setUp();
1515

16-
$this->visible(fn (): bool => auth()->user()->can('viewAny', FilamentComment::class));
16+
$this->visible(fn (): bool => auth()->user()->can('viewAny', config('filament-comments.comment_model')));
1717
}
1818
}

src/Livewire/CommentsComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function mount(): void
2727

2828
public function form(Form $form): Form
2929
{
30-
if (!auth()->user()->can('create', FilamentComment::class)) {
30+
if (!auth()->user()->can('create', config('filament-comments.comment_model'))) {
3131
return $form;
3232
}
3333

@@ -45,7 +45,7 @@ public function form(Form $form): Form
4545

4646
public function create(): void
4747
{
48-
if (!auth()->user()->can('create', FilamentComment::class)) {
48+
if (!auth()->user()->can('create', config('filament-comments.comment_model'))) {
4949
return;
5050
}
5151

src/Tables/Actions/CommentsAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ protected function setUp(): void
3030
->modalWidth(MaxWidth::Medium)
3131
->modalSubmitAction(false)
3232
->modalCancelAction(false)
33-
->visible(fn (): bool => auth()->user()->can('viewAny', FilamentComment::class));
33+
->visible(fn (): bool => auth()->user()->can('viewAny', config('filament-comments.comment_model')));
3434
}
3535
}

0 commit comments

Comments
 (0)