Backend for songs.zachdecook.com
Diffstat (limited to 'laravel/app/Song.php')
| -rw-r--r-- | laravel/app/Song.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/laravel/app/Song.php b/laravel/app/Song.php index 99b0aa4..6705dfa 100644 --- a/laravel/app/Song.php +++ b/laravel/app/Song.php @@ -12,6 +12,13 @@ class Song extends Model { return $this->belongsToMany('App\Playlist'); } + public static function whereVerse($passage) + { + $book = explode(' ',$passage)[0]; + $chapter = (int)explode(' ', $passage)[1]; + + return Song::where('verse', 'LIKE', "$book $chapter:%")->orWhere('verse',"$book $chapter"); + } public function textTranspose($key) { $sc = new SongController(); |