mercredi 25 janvier 2017

SQL to Eloquent Syntax

I am converting a PHP app to Laravel 5.3. I have a Verse model and use it like: (Verse::where('book',43') with no problems).

The following SQL would query the database for an api call like John (which is book 43)1-3:3.

How can I convert the following SQL into Eloquent syntax to achieve the same results?

SELECT * 
FROM `verses` 
WHERE `version` = 'kjv' 
AND `book` = 43
AND (`chapter` in (1,2,3) 
OR (`chapter` = 3 AND `verse` <= 3) )

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire