Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created

AclGroup::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Modules\Acl\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
use App\Modules\Acl\Http\Resources\AclUser as UserResource;
7
use App\Modules\Acl\Http\Resources\AclPermission as PermissionResource;
8
9 View Code Duplication
class AclGroup 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...
10
{
11
    /**
12
     * Transform the resource into an array.
13
     *
14
     * @param  \Illuminate\Http\Request  $request
15
     * @return array
16
     */
17
    public function toArray($request)
18
    {
19
        return [
20
            'id' => $this->id,
21
            'name' => $this->name,
22
            'users' => UserResource::collection($this->whenLoaded('users')),
23
            'permissions' => PermissionResource::collection($this->whenLoaded('permissions')),
24
            'createdAt' => $this->created_at,
25
            'updatedAt' => $this->updated_at,
26
        ];
27
    }
28
}
29