Skip to content

A free open source IT asset/license management system

Reduce ifs

Marcus Mooreca1ef2d85f47
diff --git a/app/Mail/CheckoutAccessoryMail.php b/app/Mail/CheckoutAccessoryMail.php
index 89340f277f..06bb3116bf 100644
--- a/app/Mail/CheckoutAccessoryMail.php
+++ b/app/Mail/CheckoutAccessoryMail.php
@@ -133,11 +133,7 @@ class CheckoutAccessoryMail extends BaseMailable
private function getLocation(): ?string
{
- if ($this->target instanceof User) {
- return $this->target->location?->name;
- }
-
- if ($this->target instanceof Asset) {
+ if ($this->target instanceof Asset || $this->target instanceof User) {
return $this->target->location?->name;
}
diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php
index 772536df27..7125c362ff 100644
--- a/app/Mail/CheckoutAssetMail.php
+++ b/app/Mail/CheckoutAssetMail.php
@@ -180,11 +180,7 @@ class CheckoutAssetMail extends BaseMailable
private function getLocation(): ?string
{
- if ($this->target instanceof User) {
- return $this->target->location?->name;
- }
-
- if ($this->target instanceof Asset) {
+ if ($this->target instanceof Asset || $this->target instanceof User) {
return $this->target->location?->name;
}