Skip to content

Commit

Permalink
Only add the delete url if there is a user id is present
Browse files Browse the repository at this point in the history
Fixes #623

Signed-off-by: Micheal Mand <micheal@kmdwebdesigns.com>
  • Loading branch information
mikemand committed Oct 10, 2018
1 parent 2cbb0a6 commit 5551aca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Transformers/FullRoleTransformer.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public function toArray($request)
'created_at' => $this->created_at, 'created_at' => $this->created_at,
'permissions' => $permissions, 'permissions' => $permissions,
'users' => UserTransformer::collection($this->whenLoaded('users')), 'users' => UserTransformer::collection($this->whenLoaded('users')),
'urls' => [ 'urls' => [],
'delete_url' => route('api.user.role.destroy', $this->id),
],
]; ];
if ($this->id) {
$data['urls'] = [
'delete_url' => route('api.user.role.destroy', $this->id),
];
}


return $data; return $data;
} }
Expand Down

0 comments on commit 5551aca

Please sign in to comment.