Completed
Push — master ( 0dfd17...a38508 )
by Sherif
02:04
created

Role::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace App\Modules\Roles\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7 View Code Duplication
class Role extends JsonResource
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * Transform the resource into an array.
11
     *
12
     * @param Request $request
13
     * @return array
14
     */
15
    public function toArray($request)
16
    {
17
        if (! $this->resource) {
18
            return [];
19
        }
20
21
        return [
22
            'id' => $this->id,
23
            // Add attributes here
24
            'created_at' => $this->created_at,
25
            'updated_at' => $this->updated_at,
26
        ];
27
    }
28
}
29