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

ReservationTableService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 79.17%

Importance

Changes 0
Metric Value
dl 0
loc 43
ccs 19
cts 24
cp 0.7917
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
B getColumns() 0 36 1
A getRouteName() 0 3 1
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