File tree 7 files changed +13
-7
lines changed
7 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 15
15
'empty ' => 'heroicon-s-chat-bubble-left-right ' ,
16
16
],
17
17
18
+
19
+ /*
20
+ * The comment model to be used
21
+ */
22
+ 'comment_model ' => \Parallax \FilamentComments \Models \FilamentComment::class,
23
+
18
24
/*
19
25
* The policy that will be used to authorize actions against comments.
20
26
*/
Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ protected function setUp(): void
29
29
->modalWidth (MaxWidth::Medium)
30
30
->modalSubmitAction (false )
31
31
->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 ' ));
33
33
}
34
34
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public function packageBooted(): void
55
55
{
56
56
Livewire::component ('comments ' , CommentsComponent::class);
57
57
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));
59
59
60
60
FilamentAsset::register (
61
61
$ this ->getAssets (),
Original file line number Diff line number Diff line change @@ -13,6 +13,6 @@ protected function setUp(): void
13
13
{
14
14
parent ::setUp ();
15
15
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 ' ) ));
17
17
}
18
18
}
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function mount(): void
27
27
28
28
public function form (Form $ form ): Form
29
29
{
30
- if (!auth ()->user ()->can ('create ' , FilamentComment::class )) {
30
+ if (!auth ()->user ()->can ('create ' , config ( ' filament-comments.comment_model ' ) )) {
31
31
return $ form ;
32
32
}
33
33
@@ -45,7 +45,7 @@ public function form(Form $form): Form
45
45
46
46
public function create (): void
47
47
{
48
- if (!auth ()->user ()->can ('create ' , FilamentComment::class )) {
48
+ if (!auth ()->user ()->can ('create ' , config ( ' filament-comments.comment_model ' ) )) {
49
49
return ;
50
50
}
51
51
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ trait HasFilamentComments
10
10
public function filamentComments (): HasMany
11
11
{
12
12
return $ this
13
- ->hasMany (FilamentComment::class , 'subject_id ' )
13
+ ->hasMany (config ( ' filament-comments.comment_model ' ) , 'subject_id ' )
14
14
->where ('subject_type ' , $ this ->getMorphClass ())
15
15
->latest ();
16
16
}
Original file line number Diff line number Diff line change @@ -30,6 +30,6 @@ protected function setUp(): void
30
30
->modalWidth (MaxWidth::Medium)
31
31
->modalSubmitAction (false )
32
32
->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 ' ) ));
34
34
}
35
35
}
You can’t perform that action at this time.
0 commit comments