Completed
Push — master ( fa257f...84e799 )
by Adam
05:01
created

ReservationTableService::getRouteName()   A

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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 2
    public function getRouteName()
10
    {
11 2
        return 'reservation';
12
    }
13
14 2
    public function getColumns()
15
    {
16
        $dataset = [
17
            [
18 2
                'title' => trans('general.room'),
19 2
                'value' => function (Reservation $data) {
20
                    return $data->room->number;
21 2
                },
22
            ],
23
            [
24 2
                'title' => trans('general.guest'),
25 2
                'value' => function (Reservation $data) {
26
                    return $data->guest->first_name.' '.$data->guest->last_name;
27 2
                },
28
            ],
29
            [
30 2
                'title' => trans('general.date_start'),
31 2
                'value' => function (Reservation $data) {
32
                    return $data->date_start;
33 2
                },
34
            ],
35
            [
36 2
                'title' => trans('general.date_end'),
37 2
                'value' => function (Reservation $data) {
38
                    return $data->date_end;
39 2
                },
40
            ],
41
            [
42 2
                'title' => trans('general.people'),
43 2
                'value' => function (Reservation $data) {
44
                    return $data->people;
45 2
                },
46
            ],
47
        ];
48
49 2
        return $dataset;
50
    }
51
}
52