File tree 7 files changed +49
-5
lines changed
7 files changed +49
-5
lines changed Original file line number Diff line number Diff line change 23
23
"php" : " ^8.1" ,
24
24
"filament/filament" : " ^3.0" ,
25
25
"spatie/laravel-package-tools" : " ^1.15.0" ,
26
- "illuminate/contracts" : " ^10.0"
26
+ "illuminate/contracts" : " ^10.0 | ^11.0 "
27
27
},
28
28
"autoload" : {
29
29
"psr-4" : {
Original file line number Diff line number Diff line change 53
53
* Authenticatable model class
54
54
*/
55
55
'authenticatable ' => \App \Models \User::class,
56
+
57
+
58
+ /*
59
+ * The name of the table where the comments are stored.
60
+ */
61
+ 'table_name ' => 'filament_comments ' ,
56
62
];
Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ return new class extends Migration
8
8
{
9
9
public function up(): void
10
10
{
11
- Schema::table(' filament_comments', function (Blueprint $table) {
11
+ Schema::table(config('filament-comments.table_name', ' filament_comments') , function (Blueprint $table) {
12
12
$table->index(['subject_type', 'subject_id']);
13
13
});
14
14
}
15
15
16
16
public function down(): void
17
17
{
18
- Schema::table(' filament_comments', function (Blueprint $table) {
18
+ Schema::table(config('filament-comments.table_name', ' filament_comments') , function (Blueprint $table) {
19
19
$table->dropIndex(['subject_type', 'subject_id']);
20
20
});
21
21
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ return new class extends Migration
8
8
{
9
9
public function up()
10
10
{
11
- Schema::create(' filament_comments', function (Blueprint $table) {
11
+ Schema::create(config('filament-comments.table_name', ' filament_comments') , function (Blueprint $table) {
12
12
$table->id();
13
13
$table->unsignedBigInteger('user_id');
14
14
$table->string('subject_type');
@@ -21,6 +21,6 @@ return new class extends Migration
21
21
22
22
public function down()
23
23
{
24
- Schema::dropIfExists(' filament_comments');
24
+ Schema::dropIfExists(config('filament-comments.table_name', ' filament_comments') );
25
25
}
26
26
};
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return [
4
+ 'comments ' => 'Kommentare ' ,
5
+ 'comments.add ' => 'Kommentar hinzufügen ' ,
6
+ 'comments.empty ' => 'Noch keine Kommentare. ' ,
7
+ 'comments.placeholder ' => 'Kommentar hinzufügen... ' ,
8
+
9
+ 'notifications.created ' => 'Kommentar hinzugefügt. ' ,
10
+ 'notifications.deleted ' => 'Kommentar gelöscht. ' ,
11
+
12
+ 'modal.heading ' => 'Kommentare ' ,
13
+ ];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return [
4
+ 'comments ' => 'Kommentarer ' ,
5
+ 'comments.add ' => 'Publiser kommentar ' ,
6
+ 'comments.empty ' => 'Ingen kommentarer enda. ' ,
7
+ 'comments.placeholder ' => 'Skriv en kommentar... ' ,
8
+
9
+ 'notifications.created ' => 'Kommentar lagt til. ' ,
10
+ 'notifications.deleted ' => 'Kommentar slettet. ' ,
11
+
12
+ 'modal.heading ' => 'Kommentarer ' ,
13
+ ];
Original file line number Diff line number Diff line change 7
7
use Illuminate \Database \Eloquent \Model ;
8
8
use Illuminate \Database \Eloquent \Relations \BelongsTo ;
9
9
use Illuminate \Database \Eloquent \SoftDeletes ;
10
+ use Illuminate \Support \Facades \Config ;
10
11
11
12
class FilamentComment extends Model
12
13
{
@@ -20,6 +21,17 @@ class FilamentComment extends Model
20
21
'comment ' ,
21
22
];
22
23
24
+ public function __construct (array $ attributes = [])
25
+ {
26
+ $ config = Config::get ('filament-comments ' );
27
+
28
+ if (isset ($ config ['table_name ' ])) {
29
+ $ this ->setTable ($ config ['table_name ' ]);
30
+ }
31
+
32
+ parent ::__construct ($ attributes );
33
+ }
34
+
23
35
public function user (): BelongsTo
24
36
{
25
37
$ authenticatable = config ('filament-comments.authenticatable ' );
You can’t perform that action at this time.
0 commit comments