Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Wildcard-like syntax in an eloquent Where clause to search between two strings

I saw the answer provided in this question Wildcard-like syntax in an eloquent Where clause? now I want to know if is there a way to search between two strings?.

basicasicaly in my code I want to show requests that have a status of new or scheduled.

$requests = DB::table('requests')
        ->select('requestDate','requestTime','status','requestID')
        ->where('requestorID', '=',$userID)
        ->where('status', 'LIKE','%New%')
        ->get();

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you can use whereIn ,The whereIn method verifies that a given column’s value is contained within the given array:

$requests = DB::table('requests')
        ->select('requestDate','requestTime','status','requestID')
        ->where('requestorID', '=',$userID)
        ->whereIn('status', ['new','scheduled'])
        ->get();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading