File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ return new class extends Migration
1010 {
1111 Schema::create(config('commentions.tables.comment_reactions', 'comment_reactions'), function (Blueprint $table) {
1212 $table->id();
13- $table->foreignId('comment_id')->constrained(config('commentions.table_name '))->cascadeOnDelete();
13+ $table->foreignId('comment_id')->constrained(config('commentions.tables.comments '))->cascadeOnDelete();
1414 $table->morphs('reactor');
1515
1616 if (config('database.default') === 'mysql') {
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ class Comment extends Model implements RenderableComment
4141 'author_id ' ,
4242 ];
4343
44+ public function getTable ()
45+ {
46+ return Config::getCommentTable ();
47+ }
48+
4449 public function author (): MorphTo
4550 {
4651 return $ this ->morphTo ();
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ class CommentReaction extends Model
2020 'reaction ' ,
2121 ];
2222
23+ public function getTable ()
24+ {
25+ return Config::getCommentReactionTable ();
26+ }
27+
2328 /** @return BelongsTo<Comment> */
2429 public function comment (): BelongsTo
2530 {
Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ public static function resolveAuthenticatedUser(): ?Commenter
2929 return $ user ;
3030 }
3131
32+ public static function getCommentTable (): string
33+ {
34+ return config ('commentions.tables.comments ' , 'comments ' );
35+ }
36+
37+ public static function getCommentReactionTable (): string
38+ {
39+ return config ('commentions.tables.comment_reactions ' , 'comment_reactions ' );
40+ }
41+
3242 public static function getCommentModel (): string
3343 {
3444 return config ('commentions.comment.model ' , Comment::class);
You can’t perform that action at this time.
0 commit comments