From 56bf277fe092f69ac351ddce3de20431f7043d7b Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 6 Feb 2018 11:02:40 -0600 Subject: [PATCH] Add shorthands for timezone to tz --- app/Models/Airport.php | 10 ++++++++++ app/Models/User.php | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/Models/Airport.php b/app/Models/Airport.php index 2045973b..ad792c98 100644 --- a/app/Models/Airport.php +++ b/app/Models/Airport.php @@ -88,10 +88,20 @@ class Airport extends BaseModel } /** + * Shorthand for getting the timezone * @return string */ public function getTzAttribute(): string { return $this->timezone; } + + /** + * Shorthand for setting the timezone + * @param $value + */ + public function setTzAttribute($value) + { + $this->attributes['timezone'] = $value; + } } diff --git a/app/Models/User.php b/app/Models/User.php index bbf48344..afc667dd 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -93,14 +93,23 @@ class User extends Authenticatable } /** - * Return the timezone - * @return mixed + * Shorthand for getting the timezone + * @return string */ - public function getTzAttribute() + public function getTzAttribute(): string { return $this->timezone; } + /** + * Shorthand for setting the timezone + * @param $value + */ + public function setTzAttribute($value) + { + $this->attributes['timezone'] = $value; + } + /** * @param mixed $size Size of the gravatar, in pixels * @return string