customer available events improvements
This commit is contained in:
@@ -172,6 +172,19 @@ class Event extends ActiveRecord
|
||||
/**
|
||||
* @return EventRegistration[]|ActiveQuery
|
||||
*/
|
||||
public function getActiveEventRegistrationsForCustomer(){
|
||||
return $this->hasMany(EventRegistration::class,['id_event' => 'id'])->andWhere(
|
||||
[
|
||||
'event_registration.canceled_at' => null,
|
||||
'event_registration.deleted_at' => null,
|
||||
'event_registration.id_customer' => \Yii::$app->user->id
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getEventRegistrationCount(){
|
||||
return count($this->getActiveEventRegistrations()->all());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user