load('role'); return [ 'type' => 'user', 'id' => $this->id, 'attributes' => [ 'name' => $this->name, 'user_role_id' => $this->user_role_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ], 'relationships' => [ 'user_role' => [ 'data' => [ 'type' => 'user_role', 'id' => $this->user_role_id, ], ], ], 'includes' => $this->when( ApiController::shouldInclude('user_role'), new UserRoleResource($this->role), ), 'links' => [ 'self' => $this->profileUrl(), ], ]; } }