I would like to convert the following sql statement into a Laravel Query Build:
SELECT
*
FROM
view_orderline_manifest_data
where
OrderID = 7
and (
ProdCategoryParentID != 4
or ProdCategoryParentID IS NOT NULL
)
Tried the following:
$orderlinedata=DB::table('view_orderline_data')
->select('ProdName','ProdID')->where('CustID',$CustID)
->where('OrderID',$OrderID)
->where('ProdCategoryParentID','!=' , 4)
->orWhereNull('ProdCategoryParentID')
->pluck('ProdName','ProdID')->all();
The problem is the following is being executed:
SELECT
*
FROM
view_orderline_manifest_data
where
OrderID = 7
and ProdCategoryParentID != 4
or ProdCategoryParentID IS NOT NULL
essentially the brackets () are not being applied.