Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( f35a35...781975 )
by Cristian
04:48
created

SluggableScopeHelpers   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A scopeWhereSlug() 0 4 1
A findBySlug() 0 4 1
A findBySlugOrFail() 0 4 1
1
<?php
2
3
namespace Backpack\CRUD\ModelTraits\SpatieTranslatable;
4
5
use Cviebrock\EloquentSluggable\SluggableScopeHelpers as OriginalSluggableScopeHelpers;
6
7
trait SluggableScopeHelpers
8
{
9
    use OriginalSluggableScopeHelpers;
10
11
    /**
12
     * Query scope for finding a model by its primary slug.
13
     *
14
     * @param \Illuminate\Database\Eloquent\Builder $scope
15
     * @param string $slug
16
     * @return \Illuminate\Database\Eloquent\Builder
17
     */
18
    public function scopeWhereSlug($scope, $slug)
19
    {
20
        return $scope->where($this->getSlugKeyName().'->'.$this->getLocale(), $slug);
21
    }
22
23
    /**
24
     * Find a model by its primary slug.
25
     *
26
     * @param string $slug
27
     * @param array $columns
28
     * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null
29
     */
30
    public static function findBySlug($slug, array $columns = ['*'])
31
    {
32
        return static::whereSlug($slug)->first($columns);
33
    }
34
35
    /**
36
     * Find a model by its primary slug or throw an exception.
37
     *
38
     * @param string $slug
39
     * @param array $columns
40
     * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection
41
     *
42
     * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
43
     */
44
    public static function findBySlugOrFail($slug, array $columns = ['*'])
45
    {
46
        return static::whereSlug($slug)->firstOrFail($columns);
47
    }
48
}
49