Permalink
Browse files

Merge pull request #625 from mikemand/hotfix/issue-623

Only add the delete url if there is a user id is present
  • Loading branch information...
nWidart committed Oct 10, 2018
2 parents 1604c25 + 09085be commit 230d6232d24a0d1f71c0a8193a3ce286d9bdfb44
Showing with 6 additions and 3 deletions.
  1. +6 −3 Modules/User/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 230d623

Please sign in to comment.