Last active
July 8, 2016 23:30
-
-
Save nathanaelphilip/84e0c061e0ad2826cbe59f53dc349151 to your computer and use it in GitHub Desktop.
add attribute to model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected $appends = array( | |
'date_range', | |
'share_url' | |
); | |
public function getShareUrl() | |
{ | |
$starts_at = Carbon::parse($this->starts_at); | |
$share_url = '/calendar/' . $starts_at->year . '/' . $starts_at->month . '/#event/' . $this->id; | |
return $this->attributes['share_url'] = $share_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment