Skip to content

Commit

Permalink
Simplify User::nameOrEmail()
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Jun 8, 2024
1 parent 5e87713 commit 9dab336
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Cms/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,7 @@ public function name(): Field
*/
public function nameOrEmail(): Field
{
$name = $this->name();
return $name->isNotEmpty() ? $name : new Field($this, 'email', $this->email());
return $this->name()->or(new Field($this, 'email', $this->email()));
}

/**
Expand Down

0 comments on commit 9dab336

Please sign in to comment.