website/app/Fieldprotocol/Music/Album.php

35 lines
626 B
PHP
Raw Normal View History

2016-04-20 21:53:00 -04:00
<?php
namespace Fieldprotocol\Music;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Album extends Eloquent {
protected $table = 'albums';
protected $fillable = [
'title',
'description',
'album_art',
'release_date',
];
public function songs() {
2016-04-21 00:00:28 -04:00
return $this->hasMany('Fieldprotocol\Music\Song');
2016-04-20 21:53:00 -04:00
}
2016-12-06 16:48:03 -05:00
public function links() {
return $this->hasMany('Fieldprotocol\Music\StoreLink', 'album_id');
}
public function releaseDate() {
2016-11-29 12:06:26 -05:00
return date('F j, Y', strtotime($this->release_date));
}
2016-11-29 11:43:11 -05:00
public function releaseYear() {
2016-11-29 11:43:46 -05:00
return date('Y', strtotime($this->release_date));
2016-11-29 11:43:11 -05:00
}
2016-04-20 21:53:00 -04:00
}