Added models for albums and songs
This commit is contained in:
22
app/Fieldprotocol/Music/Album.php
Normal file
22
app/Fieldprotocol/Music/Album.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
21
app/Fieldprotocol/Music/Song.php
Normal file
21
app/Fieldprotocol/Music/Song.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Fieldprotocol\Music;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Song extends Eloquent {
|
||||
|
||||
protected $table = 'songs';
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'album_id',
|
||||
'track_order',
|
||||
];
|
||||
|
||||
public function album() {
|
||||
return $this->belongsTo('FieldProtocol\Music\Album');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user