mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
show all active services for suppliers when not in segment
This commit is contained in:
+19
-7
@@ -109,7 +109,7 @@ class Company extends AbstractModel implements Documentable
|
|||||||
{
|
{
|
||||||
return $this->hasManyDeep(Transaction::class, [Booking::class], ['company_id', 'owner_id'], ['id', 'id']);
|
return $this->hasManyDeep(Transaction::class, [Booking::class], ['company_id', 'owner_id'], ['id', 'id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HasMany
|
* @return HasMany
|
||||||
*/
|
*/
|
||||||
@@ -130,13 +130,25 @@ class Company extends AbstractModel implements Documentable
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function services(): Builder {
|
public function services(): Builder {
|
||||||
return ServiceType::where('status', ApprovalStatus::APPROVED)->whereHas('constants', function($query) {
|
|
||||||
$query->Where(function($query){
|
if ($this->type === 3) {
|
||||||
$query->where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->is_active', true);
|
return ServiceType::where('status', ApprovalStatus::APPROVED)->whereHas('constants', function($query) {
|
||||||
})->orWhere(function($query) {
|
$query->where(function($query) {
|
||||||
$query->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->where('detail->is_active', true)->whereIn('segment_id', $this->segments->pluck('id'));
|
$query->where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->is_active', true);
|
||||||
|
})->orWhere(function($query) {
|
||||||
|
$query->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->where('detail->is_active', true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
// Existing logic for other company types
|
||||||
|
return ServiceType::where('status', ApprovalStatus::APPROVED)->whereHas('constants', function($query) {
|
||||||
|
$query->Where(function($query){
|
||||||
|
$query->where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->is_active', true);
|
||||||
|
})->orWhere(function($query) {
|
||||||
|
$query->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->where('detail->is_active', true)->whereIn('segment_id', $this->segments->pluck('id'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function servicesConfigurations(): Collection {
|
public function servicesConfigurations(): Collection {
|
||||||
|
|||||||
Reference in New Issue
Block a user