*/ protected $fillable = [ 'tenant_id', 'name', 'cover_image', 'type', 'age_min', 'age_max', 'gender', 'price', 'duration_months', 'session_count', 'description', 'is_active', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'age_min' => 'integer', 'age_max' => 'integer', 'price' => 'decimal:2', 'duration_months' => 'integer', 'session_count' => 'integer', 'is_active' => 'boolean', ]; /** * Get the club that owns the package. */ public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } /** * Get the activities included in the package. */ public function activities(): BelongsToMany { return $this->belongsToMany(ClubActivity::class, 'club_package_activities', 'package_id', 'activity_id') ->withPivot('instructor_id') ->withTimestamps(); } /** * Get the subscriptions for the package. */ public function subscriptions(): HasMany { return $this->hasMany(ClubMemberSubscription::class, 'package_id'); } /** * Get active subscriptions for the package. */ public function activeSubscriptions(): HasMany { return $this->hasMany(ClubMemberSubscription::class, 'package_id') ->where('status', 'active'); } }