Page::slug()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CSlant\Blog\Core\Models;
4
5
use AllowDynamicProperties;
6
use CSlant\Blog\Core\Models\Base\BasePage;
7
use Illuminate\Database\Eloquent\Builder;
8
use Illuminate\Database\Eloquent\Relations\HasOne;
9
10
/**
11
 * @mixin BasePage
12
 * @package CSlant\Blog\Core\Models
13
 *
14
 * @property int $id
15
 * @property string $name
16
 * @property string $description
17
 * @property string $content
18
 * @property string $status
19
 * @property string $template
20
 * @property string $image
21
 * @property int $user_id
22
 *
23
 * @method static Builder|Page find($id, $columns = ['*'])
24
 * @method static Builder|Page first($columns = ['*'])
25
 * @method static Builder|Page newModelQuery()
26
 * @method static Builder|Page newQuery()
27
 * @method static Builder|Page query()
28
 * @method static Builder|Page where($column, $operator = null, $value = null, $boolean = 'and')
29
 * @method static Builder|Page whereId($value)
30
 * @method static Builder|Page whereIn($column, $values, $boolean = 'and', $not = false)
31
 * @method static Builder|Page with($relations)
32
 */
33
#[AllowDynamicProperties]
34
class Page extends BasePage
35
{
36
    public function slug(): HasOne
37
    {
38
        return $this->hasOne(Slug::class, 'reference_id', 'id')
39
            ->where('reference_type', $this->getBaseModel());
40
    }
41
}
42