Skip to content

Commit 07d5ae5

Browse files
Merge pull request #12 from PetroZaburko/main
Added authenticatable model class in config file
2 parents 1eae6d5 + 85faa5a commit 07d5ae5

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

config/filament-comments.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,9 @@
4848
* The attribute used to display the user's name.
4949
*/
5050
'user_name_attribute' => 'name',
51+
52+
/*
53+
* Authenticatable model class
54+
*/
55+
'authenticatable' => \App\Models\User::class,
5156
];
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
'comments' => 'Комментарии',
5+
'comments.add' => 'Добавить комментарий',
6+
'comments.empty' => 'Комментариев пока нет.',
7+
'comments.placeholder' => 'Добавить комментарий...',
8+
9+
'notifications.created' => 'Комментарий добавлен.',
10+
'notifications.deleted' => 'Комментарий удален.',
11+
12+
'modal.heading' => 'Комментарии',
13+
];
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
'comments' => 'Коментарі',
5+
'comments.add' => 'Додати коментар',
6+
'comments.empty' => 'Поки немає коментарів.',
7+
'comments.placeholder' => 'Додати коментар...',
8+
9+
'notifications.created' => 'Коментар додано.',
10+
'notifications.deleted' => 'Коментар видалено.',
11+
12+
'modal.heading' => 'Коментарі',
13+
];

src/Models/FilamentComment.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Parallax\FilamentComments\Models;
44

5-
use Illuminate\Contracts\Auth\Authenticatable;
65
use Illuminate\Database\Eloquent\Builder;
76
use Illuminate\Database\Eloquent\MassPrunable;
87
use Illuminate\Database\Eloquent\Model;
@@ -23,9 +22,9 @@ class FilamentComment extends Model
2322

2423
public function user(): BelongsTo
2524
{
26-
$authenticatable = app(Authenticatable::class);
25+
$authenticatable = config('filament-comments.authenticatable');
2726

28-
return $this->belongsTo($authenticatable::class, 'user_id');
27+
return $this->belongsTo($authenticatable, 'user_id');
2928
}
3029

3130
public function subject(): BelongsTo

0 commit comments

Comments
 (0)