File tree Expand file tree Collapse file tree 7 files changed +13
-7
lines changed Expand file tree Collapse file tree 7 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1515 'empty ' => 'heroicon-s-chat-bubble-left-right ' ,
1616 ],
1717
18+
19+ /*
20+ * The comment model to be used
21+ */
22+ 'comment_model ' => \Parallax \FilamentComments \Models \FilamentComment::class,
23+
1824 /*
1925 * The policy that will be used to authorize actions against comments.
2026 */
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 (),
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ trait HasFilamentComments
1010 public function filamentComments (): HasMany
1111 {
1212 return $ this
13- ->hasMany (FilamentComment::class , 'subject_id ' )
13+ ->hasMany (config ( ' filament-comments.comment_model ' ) , 'subject_id ' )
1414 ->where ('subject_type ' , $ this ->getMorphClass ())
1515 ->latest ();
1616 }
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments