Something like this seems to work, not final though
public function otherDistrictCountRelation()
{
return $this->hasOne('Registration', 'event_id')
->join('user_attributes', function ($join) {
$join->on('user_attributes.internalKey', '=', 'user_id')->where('user_attributes.centre_id', '=', 0);
})
->selectRaw('event_id, count(*) as count')->groupBy('event_id');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community