Backend for songs.zachdecook.com
Song: Fix searching for "Psalms" => "Psalm"
| -rw-r--r-- | laravel/app/Song.php | 6 | ||||
| -rw-r--r-- | laravel/composer.lock | 12 |
2 files changed, 8 insertions, 10 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) { diff --git a/laravel/composer.lock b/laravel/composer.lock index 22b53c8..9db0e12 100644 --- a/laravel/composer.lock +++ b/laravel/composer.lock @@ -4521,16 +4521,16 @@ }, { "name": "techwilk/bible-verse-parser", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/TechWilk/bible-verse-parser.git", - "reference": "9edb9a94ac44cb0e4a2815159280c7375cc91f0c" + "reference": "44e8cbeecf60b747f844dd3cd7b5a4ce8015237d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TechWilk/bible-verse-parser/zipball/9edb9a94ac44cb0e4a2815159280c7375cc91f0c", - "reference": "9edb9a94ac44cb0e4a2815159280c7375cc91f0c", + "url": "https://api.github.com/repos/TechWilk/bible-verse-parser/zipball/44e8cbeecf60b747f844dd3cd7b5a4ce8015237d", + "reference": "44e8cbeecf60b747f844dd3cd7b5a4ce8015237d", "shasum": "" }, "require": { @@ -4568,9 +4568,9 @@ ], "support": { "issues": "https://github.com/TechWilk/bible-verse-parser/issues", - "source": "https://github.com/TechWilk/bible-verse-parser/tree/2.2.0" + "source": "https://github.com/TechWilk/bible-verse-parser/tree/2.3.0" }, - "time": "2022-05-15T20:03:15+00:00" + "time": "2022-09-27T18:58:48+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", |