class BirthdayMembersWidget extends BaseWidget
{
public Carbon $startDate;
public function mount(): void
{
$this->startDate = today();
}
protected function getTableHeaderActions(): array
{
return [
Tables\Actions\Action::make('Next')
->label(new HtmlString('»'))
->action(function () {
$this->startDate = $this->startDate->addWeek();
}),
];
}
protected function getTableQuery(): Builder
{
$startDate = $this->getStartDate();
$endDate = $this->getEndDate();
return User::query()
->select(['id', 'full_name', 'birthday'])
->whereBirthday($startDate, $endDate)
->orderByBirthday();
}
class BirthdayMembersWidget extends BaseWidget
{
public Carbon $startDate;
public function mount(): void
{
$this->startDate = today();
}
protected function getTableHeaderActions(): array
{
return [
Tables\Actions\Action::make('Next')
->label(new HtmlString('»'))
->action(function () {
$this->startDate = $this->startDate->addWeek();
}),
];
}
protected function getTableQuery(): Builder
{
$startDate = $this->getStartDate();
$endDate = $this->getEndDate();
return User::query()
->select(['id', 'full_name', 'birthday'])
->whereBirthday($startDate, $endDate)
->orderByBirthday();
}