affiliations

This commit is contained in:
ghassan committed 2026-01-27 16:34:46 +03:00
1 parent 4f3f9c9aad
commit 0b5b3dd3ee
177 files changed
+9660 -8531

No files matched your search

+23
View File
@@ -49,6 +49,29 @@ class ClubAffiliation extends Model
return $this->hasMany(AffiliationMedia::class);
}
/**
* Get the subscriptions associated with this affiliation.
*/
public function subscriptions(): HasMany
{
return $this->hasMany(ClubMemberSubscription::class, 'club_affiliation_id');
}
/**
* Get the packages through subscriptions.
*/
public function packages()
{
return $this->hasManyThrough(
ClubPackage::class,
ClubMemberSubscription::class,
'club_affiliation_id', // Foreign key on subscriptions table
'id', // Foreign key on packages table
'id', // Local key on affiliations table
'package_id' // Local key on subscriptions table
);
}
/**
* Get the duration of the affiliation in months.
*/