Backend for songs.zachdecook.com
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Song extends Model
{
	public $fillable = ['number', 'title', 'author', 'key', 'text'];
    public function playlists()
    {
        return $this->belongsToMany('App\Playlist');
    }
    public function getNameAttribute()
    {
        return $this->title . ( $this->author ? " ($this->author)" : "" );
    }
}