fix dashboard and order ui & fix address select component and added reference to addresses

This commit is contained in:
omair saleh
2021-08-12 15:01:16 +08:00
parent f876cc5822
commit fc0786264a
56 changed files with 1423 additions and 946 deletions
+24 -60
View File
@@ -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');
}
}