about summary refs log tree commit diff
path: root/laravel/app/Song.php
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2023-01-10 13:00:40 +0000
committerZach DeCook <zachdecook@librem.one>2023-01-10 13:00:40 +0000
commit653a6c4db19efbbd72c39e7723b06d6ce8291f1a (patch)
treea2b59780f7db4f1b52fa68a2f3843cc4d4944c04 /laravel/app/Song.php
parent8af58ae9f433f6d6d881e77f9128f77ea9deba19 (diff)
downloadprosongsa-653a6c4db19efbbd72c39e7723b06d6ce8291f1a.tar.gz
Song: Fix searching for "Psalms" => "Psalm"
Diffstat (limited to 'laravel/app/Song.php')
-rw-r--r--laravel/app/Song.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/laravel/app/Song.php b/laravel/app/Song.php
index e2f2589..c4722a2 100644
--- a/laravel/app/Song.php
+++ b/laravel/app/Song.php
@@ -18,10 +18,8 @@ class Song extends Model
     	$parser = new BiblePassageParser();
       // Can throw an exception.
       $refs = $parser->parse($passage);
-    	$book = (string)($refs[0]->from()->book());
-    	$chapter = $refs[0]->from()->chapter();
-    	
-		return Song::where('verse', 'LIKE', "$book $chapter:%")->orWhere('verse',"$book $chapter")->orWhere('verse', 'LIKE', "%; $book $chapter:%");
+    	$bc = explode(':', $refs[0])[0];
+		return Song::where('verse', 'LIKE', "$bc:%")->orWhere('verse',"$bc")->orWhere('verse','like',$refs[0].";%")->orWhere('verse', 'LIKE', "%; $bc:%");
     }
     public function textTranspose($key)
     {