Skip to content

Commit

Permalink
[5.x] Prevent error when Laravel Telescope serializes a user before i…
Browse files Browse the repository at this point in the history
…ts created (#10586)
  • Loading branch information
duncanmcclean authored Aug 7, 2024
1 parent d446b3b commit d0ad38c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Auth/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,28 @@ public function isTaxonomizable()

public function editUrl()
{
return cp_route('users.edit', $this->id());
if (! $id = $this->id()) {
return null;
}

return cp_route('users.edit', $id);
}

public function updateUrl()
{
return cp_route('users.update', $this->id());
if (! $id = $this->id()) {
return null;
}

return cp_route('users.update', $id);
}

public function apiUrl()
{
if (! $id = $this->id()) {
return null;
}

return Statamic::apiRoute('users.show', $this->id());
}

Expand Down

0 comments on commit d0ad38c

Please sign in to comment.