Passed
Push — develop ( f66249...fa3cec )
by Septianata
04:23
created

DenominationResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 15 1
1
<?php
2
3
namespace App\Http\Resources\DataTables;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
/**
8
 * @property \App\Models\Denomination $resource
9
 */
10
class DenominationResource 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' => 'denomination_' . $this->resource->getKey(),
23
            ])->render(),
24
            'name' => $this->resource->name,
25
            'value' => $this->resource->value,
26
            'type' => $this->resource->type->label,
27
            'quantity_per_bundle' => $this->resource->quantity_per_bundle,
28
            'action' => view('components.datatables.link', [
29
                'url' => route('denomination.edit', $this->resource),
30
                'name' => __('Details'),
31
                'class' => 'btn btn-primary',
32
            ])->render(),
33
        ];
34
    }
35
}
36