109 - Autopublishing New Concerts

This commit is contained in:
Adam Wathan
2017-05-25 12:44:30 -04:00
parent fc6389ca01
commit 9e15fbddf5
4 changed files with 25 additions and 0 deletions

View File

@@ -20,6 +20,16 @@ class Concert extends Model
return $query->whereNotNull('published_at');
}
public function isPublished()
{
return $this->published_at !== null;
}
public function publish()
{
$this->update(['published_at' => $this->freshTimestamp()]);
}
public function getFormattedDateAttribute()
{
return $this->date->format('F j, Y');