1 | <?php |
||
2 | |||
3 | namespace App\Models; |
||
4 | |||
5 | use Backpack\CRUD\app\Models\Traits\CrudTrait; |
||
6 | use Carbon\Carbon; |
||
7 | use Illuminate\Database\Eloquent\Model; |
||
8 | use Spatie\Activitylog\Traits\LogsActivity; |
||
9 | |||
10 | /** |
||
11 | * @mixin IdeHelperComment |
||
12 | */ |
||
13 | class Comment extends Model |
||
14 | { |
||
15 | use CrudTrait; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
16 | use LogsActivity; |
||
17 | |||
18 | protected $guarded = ['id']; |
||
19 | |||
20 | protected static bool $logUnguarded = true; |
||
21 | |||
22 | public function getDateAttribute() |
||
23 | { |
||
24 | return Carbon::parse($this->updated_at, 'UTC')->toFormattedDateString(); |
||
25 | } |
||
26 | |||
27 | public function commentable() |
||
28 | { |
||
29 | return $this->morphTo(); |
||
30 | } |
||
31 | |||
32 | public function author() |
||
33 | { |
||
34 | return $this->belongsTo(User::class); |
||
35 | } |
||
36 | } |
||
37 |