Passed
Pull Request — main (#69)
by Tan
03:05
created

VisitorLog   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A viewable() 0 6 1
1
<?php
2
3
namespace CSlant\Blog\Api\Models;
4
5
use Carbon\Carbon;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Relations\MorphTo;
8
9
/**
10
 * @property int $id
11
 * @property string $viewable_type
12
 * @property int $viewable_id
13
 * @property string $ip_address
14
 * @property null|string $user_agent
15
 * @property Carbon $expired_at
16
 * @property null|Carbon $created_at
17
 * @property null|Carbon $updated_at
18
 * @property-read \Eloquent|Model $viewable
19
 */
20
class VisitorLog extends Model
21
{
22
    /**
23
     * The attributes that are mass assignable.
24
     *
25
     * @var list<string>
0 ignored issues
show
Bug introduced by
The type CSlant\Blog\Api\Models\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
     */
27
    protected $fillable = [
28
        'viewable_type',
29
        'viewable_id',
30
        'ip_address',
31
        'user_agent',
32
        'expired_at',
33
    ];
34
35
    /**
36
     * The attributes that should be cast.
37
     *
38
     * @var array<string, string>
39
     */
40
    protected $casts = [
41
        'expired_at' => 'datetime',
42
    ];
43
44
    /**
45
     * Get the parent viewable model.
46
     *
47
     * @phpstan-return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, \CSlant\Blog\Api\Models\VisitorLog>
48
     */
49
    public function viewable(): MorphTo
50
    {
51
        /** @phpstan-var \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, \CSlant\Blog\Api\Models\VisitorLog> $relation */
52
        $relation = $this->morphTo();
53
54
        return $relation;
55
    }
56
}
57