Passed
Pull Request — main (#54)
by
unknown
05:58 queued 02:57
created

Post   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 2
Metric Value
eloc 6
c 3
b 1
f 2
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A comments() 0 3 1
A slug() 0 4 1
1
<?php
2
3
namespace CSlant\Blog\Core\Models;
4
5
use AllowDynamicProperties;
6
use Carbon\Carbon;
7
use CSlant\Blog\Core\Models\Base\BasePost;
8
use CSlant\LaravelLike\HasLike;
9
use FriendsOfBotble\Comment\Models\Comment;
0 ignored issues
show
Bug introduced by
The type FriendsOfBotble\Comment\Models\Comment 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...
10
use Illuminate\Database\Eloquent\Builder;
11
use Illuminate\Database\Eloquent\Relations\HasOne;
12
13
/**
14
 * Class Post
15
 *
16
 * @package CSlant\Blog\Core\Models
17
 *
18
 * @property int $id
19
 * @property string $name
20
 * @property string $description
21
 * @property string $content
22
 * @property string $status
23
 * @property int $author_id
24
 * @property string $author_type
25
 * @property int $is_featured
26
 * @property int $views
27
 * @property string $format_type
28
 * @property Carbon $created_at
29
 * @property Carbon $updated_at
30
 * @property Slug $slug
31
 * @property string $url
32
 * @property Tag[] $tags
33
 * @property Category[] $categories
34
 * @property Comment[] $comments
35
 * @property string $image
36
 * @property string $author
37
 *
38
 * @method static Builder|Post newModelQuery()
39
 * @method static Builder|Post newQuery()
40
 * @method static Builder|Post query()
41
 * @method static Builder|Post first()
42
 * @method static Builder|Post find($id)
43
 * @method static Builder|Post with($relations)
44
 * @method static Builder|Post whereId($value)
45
 * @method static Builder|Post whereIn($column, $values)
46
 * @method static Builder|Post where($column, $operator = null, $value = null, $boolean = 'and')
47
 * @method static Post findOrFail($id)
48
 * @method static Post create($data)
49
 *
50
 * @mixin BasePost
51
 */
52
#[AllowDynamicProperties]
53
class Post extends BasePost
54
{
55
    use HasLike;
56
57
    public function slug(): HasOne
58
    {
59
        return $this->hasOne(Slug::class, 'reference_id', 'id')
60
            ->where('reference_type', $this->getBaseModel());
61
    }
62
63
    public function comments()
64
    {
65
        return $this->morphMany('FriendsOfBotble\Comment\Models\Comment', 'reference');
66
    }
67
}
68