diff --git a/app/Booking.php b/app/Booking.php index 8865128..b1fb3b9 100644 --- a/app/Booking.php +++ b/app/Booking.php @@ -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 * **************************************************************************/