TranslatableResource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 39
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A indexQuery() 0 6 1
A scoutQuery() 0 4 1
A detailQuery() 0 6 1
A relatableQuery() 0 5 1
1
<?php
2
3
namespace BBSLab\NovaTranslation\Resources;
4
5
use Laravel\Nova\Http\Requests\NovaRequest;
6
use Laravel\Nova\Resource;
7
8
abstract class TranslatableResource extends Resource
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public static function indexQuery(NovaRequest $request, $query)
14
    {
15
        return $query
16
            ->locale()
17
            ->with('translation');
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public static function scoutQuery(NovaRequest $request, $query)
24
    {
25
        return $query;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public static function detailQuery(NovaRequest $request, $query)
32
    {
33
        return parent::detailQuery($request, $query)
34
            //->locale()
35
            ->with('translation');
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public static function relatableQuery(NovaRequest $request, $query)
42
    {
43
        return parent::relatableQuery($request, $query)
44
            ->locale();
45
    }
46
}
47