Here is my code:
$tracking_codes_obj = new TrackingCode;
$tracking_code = 140;
if ( !is_null($tracking_code) )
$tracking_codes_obj->where('tracking_code', $tracking_code);
$tracking_codes = $tracking_codes_obj->orderBy('expired')->orderBy('id')->paginate(10);
As you can see $tracking_code is not null, so that condition is true and that where clause should be applied. But still the result is the same as when I completely remove that condition.
Why and how can I fix it?