Comment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A author() 0 3 1
A getDateAttribute() 0 3 1
A commentable() 0 3 1
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