TranslationScope   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 6 1
1
<?php
2
3
namespace RichanFongdasen\I18n\Eloquent;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Scope;
8
9
class TranslationScope implements Scope
10
{
11
    /**
12
     * Eloquent model object.
13
     *
14
     * @var \Illuminate\Database\Eloquent\Model
15
     */
16
    public $model;
17
18
    /**
19
     * Apply the scope to a given Eloquent query builder.
20
     *
21
     * @param \Illuminate\Database\Eloquent\Builder $builder
22
     * @param \Illuminate\Database\Eloquent\Model   $model
23
     *
24
     * @return \Illuminate\Database\Eloquent\Builder
25
     */
26
    public function apply(Builder $builder, Model $model): Builder
27
    {
28
        $this->model = $model;
29
30
        return $builder->with('translations');
31
    }
32
}
33