Added models for albums and songs
This commit is contained in:
parent
cdd075f186
commit
904b103f8c
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,7 +9,8 @@ use Slim\Views\TwigExtension;
|
|||||||
use Noodlehaus\Config;
|
use Noodlehaus\Config;
|
||||||
|
|
||||||
// Our dependencies
|
// Our dependencies
|
||||||
//use Fieldprotocol\User\User;
|
use Fieldprotocol\Music\Album;
|
||||||
|
use FieldProtocol\Music\Song;
|
||||||
|
|
||||||
// Let's get this session started
|
// Let's get this session started
|
||||||
session_cache_limiter(false);
|
session_cache_limiter(false);
|
||||||
@ -48,12 +49,14 @@ require 'routes.php';
|
|||||||
|
|
||||||
//$app->auth = false;
|
//$app->auth = false;
|
||||||
|
|
||||||
$app->container->set('user', function() {
|
// Album singleton
|
||||||
return new User;
|
$app->container->set('album', function() {
|
||||||
});
|
return new Album;
|
||||||
|
})
|
||||||
|
|
||||||
$app->container->set('post', function() {
|
// Song singleton
|
||||||
return new Post;
|
$app->container->set('song', function() {
|
||||||
|
return new Song;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Slappin' some hoes with our views
|
// Slappin' some hoes with our views
|
||||||
|
Loading…
Reference in New Issue
Block a user