ReservationTableService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 43
ccs 19
cts 19
cp 1
rs 10
c 2
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteName() 0 3 1
A getColumns() 0 36 1
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\Reservation;
6
7
class ReservationTableService implements TableServiceInterface
8
{
9 32
    public function getRouteName()
10
    {
11 32
        return 'reservation';
12
    }
13
14 21
    public function getColumns()
15
    {
16
        $dataset = [
17
            [
18 21
                'title' => trans('general.room'),
19
                'value' => function (Reservation $data) {
20 12
                    return '<a href="'.route('room.editform', [$data->room->id]).'">'.$data->room->number.'</a>';
21 21
                },
22
            ],
23
            [
24 21
                'title' => trans('general.guest'),
25
                'value' => function (Reservation $data) {
26 12
                    return '<a href="'.route('guest.editform', [$data->guest->id]).'">'.$data->guest->full_name.'</a>';
27 21
                },
28
            ],
29
            [
30 21
                'title' => trans('general.date_start'),
31
                'value' => function (Reservation $data) {
32 12
                    return $data->date_start;
33 21
                },
34
            ],
35
            [
36 21
                'title' => trans('general.date_end'),
37
                'value' => function (Reservation $data) {
38 12
                    return $data->date_end;
39 21
                },
40
            ],
41
            [
42 21
                'title' => trans('general.number_of_people'),
43
                'value' => function (Reservation $data) {
44 12
                    return $data->people;
45 21
                },
46
            ],
47
        ];
48
49 21
        return $dataset;
50
    }
51
}
52