Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class LocalizableBuilder extends Builder |
||
9 | { |
||
10 | /** |
||
11 | * @var bool |
||
12 | */ |
||
13 | protected $translationJoined = false; |
||
14 | |||
15 | /** |
||
16 | * Add an "order by" clause to the query. |
||
17 | * |
||
18 | * @param string $column |
||
19 | * @param string $direction |
||
20 | * @return Builder|LocalizableBuilder |
||
21 | */ |
||
22 | public function orderBy($column, $direction = 'asc') |
||
23 | { |
||
24 | /** @var Localizable $localizableModel */ |
||
25 | $localizableModel = $this->model; |
||
26 | |||
27 | if ($localizableModel->isLocalizableAttribute($column)) { |
||
28 | $this->joinWithTranslation(); |
||
29 | } |
||
30 | |||
31 | return parent::orderBy($column, $direction); |
||
|
|||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @since 1.0.0 |
||
36 | */ |
||
37 | public function joinWithTranslation() |
||
50 | } |
||
51 | } |
||
53 |