Passed
Pull Request — main (#69)
by
unknown
03:27
created

PostView   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A post() 0 3 1
1
<?php
2
3
namespace CSlant\Blog\Api\Models;
4
5
use CSlant\Blog\Core\Models\Post;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8
9
class PostView extends Model
10
{
11
    protected $table = 'post_views';
12
13
    protected $fillable = [
14
        'post_id',
15
        'ip_address',
16
        'time_check',
17
    ];
18
19
    protected $casts = [
20
        'time_check' => 'datetime',
21
    ];
22
23
    public function post(): BelongsTo
24
    {
25
        return $this->belongsTo(Post::class, 'post_id');
26
    }
27
}
28