SendingTrend::cacheFor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace NovaFormEntries\Metrics;
4
5
use FormEntries\Models\FormEntry;
6
use Illuminate\Http\Request;
7
use Laravel\Nova\Metrics\Trend;
8
9
class SendingTrend extends Trend
10
{
11
    /**
12
     * Calculate the value of the metric.
13
     *
14
     * @param  \Illuminate\Http\Request  $request
15
     * @return mixed
16
     */
17 1
    public function calculate(Request $request)
18
    {
19 1
        return $this->countByDays($request, FormEntry::class);
20
    }
21
22
    /**
23
     * Get the ranges available for the metric.
24
     *
25
     * @return array
26
     */
27 1
    public function ranges()
28
    {
29 1
        return [
30 1
            30 => '30 Days',
31 1
            60 => '60 Days',
32 1
            90 => '90 Days',
33 1
        ];
34
    }
35
36
    /**
37
     * Get the URI key for the metric.
38
     *
39
     * @return string
40
     */
41 1
    public function uriKey()
42
    {
43 1
        return 'form-entries-per-day';
44
    }
45
46
    /**
47
     * Determine for how many minutes the metric should be cached.
48
     *
49
     * @return  \DateTimeInterface|\DateInterval|float|int
50
     */
51 1
    public function cacheFor()
52
    {
53 1
        return now()->addMinutes(30);
54
    }
55
}
56