Comment::author()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
The trait Backpack\CRUD\app\Models\Traits\CrudTrait requires some properties which are not provided by App\Models\Comment: $fakeColumns, $identifiableAttribute, $Type
Loading history...
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