Passed
Push — develop ( 5f0aa7...736d84 )
by Septianata
04:40
created

ConfigurationResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 13
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 12
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 14 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
    public function toArray($request)
19
    {
20
        return [
21
            'checkbox' => view('components.datatables.checkbox', [
22
                'id' => 'configuration_' . $this->resource->getKey(),
23
            ])->render(),
24
            'key' => $this->resource->key,
25
            'value' => $this->resource->value,
26
            'description' => $this->resource->description,
27
            'action' => view('components.datatables.link', [
28
                'url' => route('configuration.edit', $this->resource),
29
                'name' => __('Details'),
30
                'class' => 'btn btn-primary',
31
            ])->render(),
32
        ];
33
    }
34
}
35