bobg
153
3
Laravel

How to access DB as a class instance?

Posted 3 months ago by bobg

I would like to programmatically build up a where clause, but DB as a facade doesn't allow for it. How can I do something like this:

$db = new DB;
$db->table('table');
if ($something) {
    $db->whereIn('field', ['a','b']);
}

Please sign in or create an account to participate in this conversation.