where(function ($q) use ($keyword) { $q->where('name', 'like', "%$keyword%") ->orWhere('unit', 'like', "%$keyword%"); }); } public function purchaseRequest() { return $this->belongsTo(PurchaseRequest::class); } public function vendorProduct() { return $this->belongsTo(VendorProduct::class); } public function purchaseRequestVendorDetails() { return $this->hasMany(PurchaseRequestVendorDetail::class); } public function unitPrice() { return $this->belongsTo(UnitPrice::class); } }