NotNullSlug   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootNotNullSlug() 0 3 1
A allowNullSlug() 0 3 1
1
<?php
2
3
namespace Distilleries\Contentful\Models\Traits;
4
5
use Distilleries\Contentful\Models\Scopes\NotNullSlugScope;
6
7
trait NotNullSlug
8
{
9
    /**
10
     * Boot the not-null-slug scope for a model.
11
     *
12
     * @return void
13
     */
14
    public static function bootNotNullSlug()
15
    {
16
        static::addGlobalScope(new NotNullSlugScope);
17
    }
18
19
    /**
20
     * Get a new query builder that also includes null-slug.
21
     *
22
     * @return \Illuminate\Database\Eloquent\Builder
23
     */
24
    public static function allowNullSlug()
25
    {
26
        return static::withoutGlobalScope(NotNullSlugScope::class);
27
    }
28
}
29