Merge rPFbe0bfa790ec5: Fixed an error with fetching the year and release date.

This commit is contained in:
Kelvin Zhang 2015-09-10 11:30:48 +01:00
parent 85586c17de
commit 6826770ace

View file

@ -377,7 +377,7 @@ class Track extends Model
public function getYearAttribute()
{
return date('Y', strtotime($this->release_date));
return date('Y', strtotime($this->getReleaseDate()));
}
public function setTitleAttribute($value)
@ -423,14 +423,14 @@ class Track extends Model
return $this->user->display_name;
}
public function getReleaseDateAttribute()
public function getReleaseDate()
{
if ($this->attributes['released_at'] !== null) {
return $this->attributes['released_at'];
if ($this->released_at !== null) {
return $this->released_at;
}
if ($this->attributes['published_at'] !== null) {
return Str::limit($this->attributes['published_at'], 10, '');
if ($this->published_at !== null) {
return Str::limit($this->published_at, 10, '');
}
return Str::limit($this->attributes['created_at'], 10, '');