Added store links to msuci player

This commit is contained in:
gballan1 2016-12-06 16:48:03 -05:00
parent 5ad45b4a4f
commit 2125e21849
3 changed files with 32 additions and 0 deletions

View File

@ -19,6 +19,10 @@ class Album extends Eloquent {
return $this->hasMany('Fieldprotocol\Music\Song');
}
public function links() {
return $this->hasMany('Fieldprotocol\Music\StoreLink', 'album_id');
}
public function releaseDate() {
return date('F j, Y', strtotime($this->release_date));
}

View File

@ -0,0 +1,20 @@
<?php
namespace Fieldprotocol\Music;
use Illuminate\Database\Eloquent\Model as Eloquent;
class StoreLink extends Eloquent {
protected $table = 'store_links';
protected $fillable = [
'link_name',
'link_ref',
];
public function album() {
return $this->belongsTo('Fieldprotocol\Music\Album', 'album_id');
}
}

View File

@ -28,6 +28,14 @@
<hr />
<p id="album-description">{{ albums[0].description }}</p>
{% endif %}
{% if albums[0].store_links %}
<hr />
<ul>
{% for link in albums[0].store_links %}
<li>Buy on <a href="{{ link.link_ref }}">{{ link.link_name }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</article>