Added method to get the PersonTarget of a Booking.

This commit is contained in:
Lukas Halbritter
2018-10-04 19:56:31 +02:00
parent fe9cb367e5
commit 9032793597
+15
View File
@@ -54,6 +54,21 @@ class Booking extends Model
return null;
}
/**
* Get the person target of the booking. If the booking consists of more than
* one sub-booking, null is returned.
*
* @return App\AccountType
*/
public function personTarget()
{
if ($this->isSimple()) {
return $this->subBookings->first()->personTarget;
}
return null;
}
/**************************************************************************
* INDIRECT PROPERTIES *
**************************************************************************/