CustomerInvoice::where(function ($query) { switch ($this->status) { case "0": case "1": case "2": $query->where('status', $this->status); break; } }) ->where('customer_id', customer()->id) ->latest() ->paginate(10) ]); } }