Only add the delete url if there is a user id is present

Fixes #623
Signed-off-by: 's avatarMicheal Mand <micheal@kmdwebdesigns.com>
parent 1604c255
......@@ -19,10 +19,13 @@ class FullRoleTransformer extends Resource
'created_at' => $this->created_at,
'permissions' => $permissions,
'users' => UserTransformer::collection($this->whenLoaded('users')),
'urls' => [
'delete_url' => route('api.user.role.destroy', $this->id),
],
'urls' => [],
];
if ($this->id) {
$data['urls'] = [
'delete_url' => route('api.user.role.destroy', $this->id),
];
}
return $data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment