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

AclUser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 18 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\AclGroup as AclGroupResource;
7
use App\Modules\Acl\Http\Resources\OauthClient as OauthClientResource;
8
use App\Modules\Notifications\Http\Resources\Notification as NotificationResource;
9
10
class AclUser 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
            'id' => $this->id,
22
            'name' => $this->name,
23
            'email' => $this->email,
24
            'profilePicture' => $this->profile_picture,
25
            'notifications' => NotificationResource::collection($this->whenLoaded('notifications')),
26
            'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')),
27
            'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')),
28
            'groups' => AclGroupResource::collection($this->whenLoaded('groups')),
29
            'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')),
30
            'locale' => $this->locale,
31
            'timeZone' => $this->time_zone,
32
            'createdAt' => $this->created_at,
33
            'updatedAt' => $this->updated_at,
34
        ];
35
    }
36
}
37