MailLog::label()   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 0
1
<?php
2
3
namespace Giuga\LaravelNovaMailLog;
4
5
use App\Nova\Resource;
6
use Giuga\LaravelNovaFieldIframe\Iframe;
7
use Illuminate\Http\Request;
8
use Laravel\Nova\Fields\DateTime;
9
use Laravel\Nova\Fields\ID;
10
use Laravel\Nova\Fields\MorphTo;
11
use Laravel\Nova\Fields\Text;
12
13
class MailLog extends Resource
14
{
15
    /**
16
     * The model the resource corresponds to.
17
     *
18
     * @var string
19
     */
20
    public static $model = \Giuga\LaravelMailLog\Models\MailLog::class;
21
22
    /**
23
     * The single value that should be used to represent the resource when being displayed.
24
     *
25
     * @var string
26
     */
27
    public static $title = 'id';
28
29
    /**
30
     * The columns that should be searched.
31
     *
32
     * @var array
33
     */
34
    public static $search = [
35
        'id', 'to', 'cc', 'bcc',
36
    ];
37
38
    public static function label()
39
    {
40
        return 'Mail Log';
41
    }
42
43
    /**
44
     * Get the fields displayed by the resource.
45
     *
46
     * @param  \Illuminate\Http\Request  $request
47
     * @return array
48
     */
49
    public function fields(Request $request)
50
    {
51
        return [
52
            ID::make()->sortable(),
53
            Text::make(__('To'))->sortable(),
54
            MorphTo::make(__('Recipient'), 'recipient'),
55
            Text::make(__('Subject'))->sortable(),
56
            Text::make(__('Cc'))->sortable(),
57
            Text::make(__('Bcc'))->sortable(),
58
            MorphTo::make(__('Process'), 'occurredProcess'),
59
            MorphTo::make(__('Entity'), 'occurredEntity'),
60
            DateTime::make(__('Created At'))->sortable(),
61
            Iframe::make(__('Message'))->onlyOnDetail(),
62
        ];
63
    }
64
65
    /**
66
     * Get the cards available for the request.
67
     *
68
     * @param  \Illuminate\Http\Request  $request
69
     * @return array
70
     */
71
    public function cards(Request $request)
72
    {
73
        return [];
74
    }
75
76
    /**
77
     * Get the filters available for the resource.
78
     *
79
     * @param  \Illuminate\Http\Request  $request
80
     * @return array
81
     */
82
    public function filters(Request $request)
83
    {
84
        return [];
85
    }
86
87
    /**
88
     * Get the lenses available for the resource.
89
     *
90
     * @param  \Illuminate\Http\Request  $request
91
     * @return array
92
     */
93
    public function lenses(Request $request)
94
    {
95
        return [];
96
    }
97
98
    /**
99
     * Get the actions available for the resource.
100
     *
101
     * @param  \Illuminate\Http\Request  $request
102
     * @return array
103
     */
104
    public function actions(Request $request)
105
    {
106
        return [];
107
    }
108
}
109