Passed
Push — develop ( c3d6a0...515348 )
by Septianata
14:35
created

ConfigurationResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 17
c 1
b 0
f 0
dl 0
loc 27
ccs 15
cts 15
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 19 1
1
<?php
2
3
namespace App\Http\Resources\DataTables;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
/**
8
 * @property \App\Models\Configuration $resource
9
 */
10
class ConfigurationResource extends JsonResource
11
{
12
    /**
13
     * Transform the resource into an array.
14
     *
15
     * @param  \Illuminate\Http\Request  $request
16
     * @return array
17
     */
18 1
    public function toArray($request)
19
    {
20
        return [
21 1
            'checkbox' => view('components.datatables.checkbox', [
22 1
                'value' => $this->resource->getKey(),
23 1
            ])->render(),
24 1
            'key' => $this->resource->key,
25 1
            'value' => $this->resource->value,
26 1
            'description' => $this->resource->description,
27 1
            'action' => view('components.datatables.button-group', [
28
                'elements' => [
29 1
                    view('components.datatables.link-show', [
30 1
                        'url' => route('admin.configuration.edit', $this->resource),
31 1
                    ])->render(),
32 1
                    view('components.datatables.link-destroy', [
33 1
                        'url' => route('admin.configuration.destroy', $this->resource),
34 1
                    ])->render(),
35
                ],
36 1
            ])->render(),
37
        ];
38
    }
39
}
40