TranslatableResource::scoutQuery()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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