public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->clients()
->addSelect([
'vacancies_count' => Vacancy::query()
->selectRaw('COUNT(*)')
->whereColumn('client_id', 'teams.id')
->active()
])
)
->inverseRelationship('user')
->columns([
TextColumn::make('vacancies_count')
->sortable(),
]);
}
public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->clients()
->addSelect([
'vacancies_count' => Vacancy::query()
->selectRaw('COUNT(*)')
->whereColumn('client_id', 'teams.id')
->active()
])
)
->inverseRelationship('user')
->columns([
TextColumn::make('vacancies_count')
->sortable(),
]);
}