Permalink
Browse files

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

Fixes #623

Signed-off-by: Micheal Mand <micheal@kmdwebdesigns.com>
  • Loading branch information...
mikemand committed Oct 10, 2018
1 parent 2cbb0a6 commit 5551aca3b0f5c70d2ed3fcb0de5ad7c12dfdee11
Showing with 6 additions and 3 deletions.
  1. +6 −3 Transformers/FullRoleTransformer.php
@@ -19,10 +19,13 @@ public function toArray($request)
'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;
}

0 comments on commit 5551aca

Please sign in to comment.