affiliations
This commit is contained in:
1 parent
4f3f9c9aad
commit
0b5b3dd3ee
177 files changed
+9660
-8531
No files matched your search
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user