mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-20 21:14:10 +00:00
fix dashboard and order ui & fix address select component and added reference to addresses
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Addressable;
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@@ -18,7 +20,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property integer type
|
||||
* @property integer status
|
||||
*/
|
||||
class CompanyModule extends AbstractModel
|
||||
class CompanyModule extends AbstractModel implements Addressable, Documentable
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -66,66 +68,28 @@ class CompanyModule extends AbstractModel
|
||||
return $this->HasMany(Order::class, 'company_module_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return belongsToMany
|
||||
*/
|
||||
public function segments(): belongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Segment::class, (new SegmentCompany())->getTable(), 'company_id', 'segment_id');
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return HasMany
|
||||
// */
|
||||
// public function addresses(): HasMany
|
||||
// {
|
||||
// return $this->HasMany(Address::class, 'company_id');
|
||||
// }
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function documents(): morphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'owner');
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return belongsToMany
|
||||
// */
|
||||
// public function segments(): belongsToMany
|
||||
// {
|
||||
// return $this->belongsToMany(Segment::class, (new SegmentCompany())->getTable(), 'company_id', 'segment_id');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @return MorphMany
|
||||
// */
|
||||
// public function documents(): morphMany
|
||||
// {
|
||||
// return $this->morphMany(Document::class, 'owner');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @return HasMany
|
||||
// */
|
||||
// public function banks(): HasMany
|
||||
// {
|
||||
// return $this->HasMany(Bank::class, 'company_id');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @return HasMany
|
||||
// */
|
||||
// public function bookings(): HasMany
|
||||
// {
|
||||
// return $this->HasMany(Booking::class, 'company_id');
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @return Builder
|
||||
// */
|
||||
// public function services(): Builder {
|
||||
// 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 {
|
||||
// return $this->services()->get()->map(function($service) {
|
||||
// return new ServiceConfigurationsObject($service,
|
||||
// $service->constants->where('reference', SegmentConstants::SERVICE_TYPE)->first(),
|
||||
// $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id')));
|
||||
// });
|
||||
// }
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function banks(): HasMany
|
||||
{
|
||||
return $this->HasMany(Bank::class, 'company_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user