Page   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A scopeBySlug() 0 4 1
1
<?php
2
3
namespace Ngtfkx\Laradeck\Pages\Models;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Database\Eloquent\Model;
7
8
/**
9
 * Ngtfkx\Laradeck\Pages\Models\Page
10
 *
11
 * @property int $id
12
 * @property \Carbon\Carbon $created_at
13
 * @property \Carbon\Carbon $updated_at
14
 * @property string $header Заголовок страницы
15
 * @property string $content Текст страницы
16
 * @property string $slug Слаг страницы
17
 * @method static \Illuminate\Database\Query\Builder|Page bySlug($slug)
18
 */
19
class Page extends Model
20
{
21
    protected $fillable = [
22
        'header', 'content', 'slug',
23
    ];
24
25
    /**
26
     * Выбрать по слагу
27
     *
28
     * @param Builder $query
29
     * @param string $slug
30
     * @return Builder
31
     */
32
    public function scopeBySlug(Builder $query, string $slug): Builder
33
    {
34
        return $query->where('slug', '=', $slug);
35
    }
36
}
37