Completed
Push — master ( edb9ee...b465c5 )
by
unknown
10:14
created

Label::actions()   A

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 1
1
<?php
2
3
namespace BBSLab\NovaTranslation\Resources;
4
5
use App\Nova\Resource;
6
use BBSLab\NovaTranslation\Models\Label as Model;
7
use BBSLab\NovaTranslation\NovaTranslationServiceProvider;
8
use Illuminate\Http\Request;
9
use Laravel\Nova\Fields\ID;
10
use Laravel\Nova\Fields\Select;
11
use Laravel\Nova\Fields\Text;
12
use Laravel\Nova\Fields\Textarea;
13
14
class Label extends Resource
15
{
16
    /**
17
     * The model the resource corresponds to.
18
     *
19
     * @var string
20
     */
21
    public static $model = 'BBS\\Nova\\Translation\\Models\\Label';
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public static $title = 'key';
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public static $search = [
32
        'key',
33
        'value',
34
    ];
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public static $group = null;
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function fields(Request $request)
45
    {
46
        return [
47
            ID::make()->sortable(),
48
49
            Select::make('Type', 'type')
50
                ->sortable()
51
                ->options([
52
                    Model::TYPE_TEXT => trans(NovaTranslationServiceProvider::PACKAGE_ID.'.labels.types.'.Model::TYPE_TEXT),
53
                    Model::TYPE_UPLOAD => trans(NovaTranslationServiceProvider::PACKAGE_ID.'.labels.types.'.Model::TYPE_UPLOAD),
54
                ])
55
                ->displayUsingLabels(),
56
57
            Text::make('Key', 'key')
58
                ->sortable()
59
                ->rules('required'),
60
61
            Textarea::make('Value', 'value')
62
                ->hideFromIndex(),
63
        ];
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function cards(Request $request)
70
    {
71
        return [];
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function filters(Request $request)
78
    {
79
        return [];
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function lenses(Request $request)
86
    {
87
        return [];
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function actions(Request $request)
94
    {
95
        return [];
96
    }
97
}
98