I have the following Laravel Eloquent code, where there will be a lot of method chaining:
$foo = EloquentFoo::orderBy('xyz');
if(true)
{
$foo->whereHas('eloquentModel',function($q){
return $q->where('name','=','john');
});
}
Given complex conditions, i need to instantiate the Eloquent Query Builder without using 'orderBy' or any other static methods.
I tried using the following, which fails miserably(don't know why):
$foo = new EloquentFoo;