ReservationTableService::getRouteName()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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