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

parent 6c4d8d6b
......@@ -22,10 +22,13 @@ class FullUserTransformer extends Resource
'created_at' => $this->created_at,
'permissions' => $permissions,
'roles' => $this->roles->pluck('id'),
'urls' => [
'urls' => [],
];
if ($this->id) {
$data['urls'] = [
'delete_url' => route('api.user.user.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