about summary refs log tree commit diff
path: root/laravel/app
diff options
context:
space:
mode:
Diffstat (limited to 'laravel/app')
-rw-r--r--laravel/app/Playlist.php14
-rw-r--r--laravel/app/Song.php5
2 files changed, 18 insertions, 1 deletions
diff --git a/laravel/app/Playlist.php b/laravel/app/Playlist.php
new file mode 100644
index 0000000..7284b0e
--- /dev/null
+++ b/laravel/app/Playlist.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Playlist extends Model
+{
+	public $fillable = ['name'];
+    public function songs()
+    {
+        return $this->belongsToMany('App\Song');
+    }
+}
diff --git a/laravel/app/Song.php b/laravel/app/Song.php
index 876617f..0565ff6 100644
--- a/laravel/app/Song.php
+++ b/laravel/app/Song.php
@@ -7,5 +7,8 @@ use Illuminate\Database\Eloquent\Model;
 class Song extends Model
 {
 	public $fillable = ['number', 'title', 'author', 'key', 'text'];
-    //
+    public function playlists()
+    {
+        return $this->belongsToMany('App\Playlist');
+    }
 }