Call to undefined method Illuminate\Database\Query\JoinClause::whereBetween()
<p>in my case, i want to display orders completed by certain user,
with certain time range,
here is my code</p>

<pre><code>$orders = DB::table('user_profiles')
            -&gt;leftJoin('orders', function($join) use ($status,$order){
                $join-&gt;on('user_profiles.id','=','orders.id_user')
                    -&gt;where('orders.status','=',$status)
                    -&gt;whereBetween('orders.created_at',[$from,$to]);
            })
            -&gt;selectRaw('user_profiles.*, count(orders.id_user) as order_try_count')
            -&gt;groupBy('user_profiles.id')
            -&gt;orderBy('order_try_count',$order)
            -&gt;paginate(15);
</code></pre>

<p>but i get Call to undefined method Illuminate\Database\Query\JoinClause::whereBetween(),
what should i do to solve this ?
thank you so much...</p>