Passed
Push — master ( 118848...a2adfc )
by Adam
05:55
created

ReservationTableService::getColumns()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 0
dl 0
loc 36
ccs 22
cts 22
cp 1
crap 1
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\Reservation;
6
7
class ReservationTableService implements TableServiceInterface
8
{
9 3
    public function getRouteName()
10
    {
11 3
        return 'reservation';
12
    }
13
14 3
    public function getColumns()
15
    {
16
        $dataset = [
17
            [
18 3
                'title' => trans('general.room'),
19 3
                'value' => function (Reservation $data) {
20 1
                    return $data->room->number;
21 3
                },
22
            ],
23
            [
24 3
                'title' => trans('general.guest'),
25 3
                'value' => function (Reservation $data) {
26 1
                    return $data->guest->full_name;
27 3
                },
28
            ],
29
            [
30 3
                'title' => trans('general.date_start'),
31 3
                'value' => function (Reservation $data) {
32 1
                    return $data->date_start;
33 3
                },
34
            ],
35
            [
36 3
                'title' => trans('general.date_end'),
37 3
                'value' => function (Reservation $data) {
38 1
                    return $data->date_end;
39 3
                },
40
            ],
41
            [
42 3
                'title' => trans('general.number_of_people'),
43 3
                'value' => function (Reservation $data) {
44 1
                    return $data->people;
45 3
                },
46
            ],
47
        ];
48
49 3
        return $dataset;
50
    }
51
}
52