From 6288883d88c420e242ffc07e81d9ca315eec4a5a Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 11 May 2022 13:27:03 +0000 Subject: gemini: Add feature to search by bible verse --- laravel/app/Song.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'laravel/app/Song.php') 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(); -- cgit 1.4.1