31 lines
		
	
	
		
			522 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			522 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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() {
 | |
|     return $this->hasMany('Fieldprotocol\Music\Song');
 | |
|   }
 | |
| 
 | |
| 	public function releaseDate() {
 | |
| 		return date('F jS, Y', strtotime($this->release_date));
 | |
| 	}
 | |
| 
 | |
| 	public function releaseYear() {
 | |
| 		return date('Y', strtotime($this->release_date));
 | |
| 	}
 | |
| 
 | |
| }
 |