feat(packages): implement package-based business model
This commit is contained in:
@@ -50,4 +50,32 @@ class Event extends Model
|
||||
return $this->belongsToMany(Task::class, 'event_task', 'event_id', 'task_id')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function eventPackage(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EventPackage::class);
|
||||
}
|
||||
|
||||
public function hasActivePackage(): bool
|
||||
{
|
||||
return $this->eventPackage && $this->eventPackage->isActive();
|
||||
}
|
||||
|
||||
public function getPackageLimits(): array
|
||||
{
|
||||
if (!$this->hasActivePackage()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->eventPackage->package->limits;
|
||||
}
|
||||
|
||||
public function canUploadPhoto(): bool
|
||||
{
|
||||
if (!$this->hasActivePackage()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->eventPackage->canUploadPhoto();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user