How to update form query after livewire parameter change

I currently have this code in a child component:
class BanTable extends Component implements HasForms, HasTable
{
use InteractsWithForms;
use InteractsWithTable;

#[Reactive]
public string $discord_id;

public function table(Table $table): Table
{
return $table
->query(Ban::query()->where('userid', $this->discord_id))
->columns([
Tables\Columns\TextColumn::make('moderatorid'),
Tables\Columns\TextColumn::make('reason'),
Tables\Columns\TextColumn::make('date'),
Tables\Columns\TextColumn::make('bantime'),
])
->filters([
//
])
->actions([
//
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
//
]),
]);
}

public function render(): View
{
return view('livewire.tables.ban-table');
}
}
class BanTable extends Component implements HasForms, HasTable
{
use InteractsWithForms;
use InteractsWithTable;

#[Reactive]
public string $discord_id;

public function table(Table $table): Table
{
return $table
->query(Ban::query()->where('userid', $this->discord_id))
->columns([
Tables\Columns\TextColumn::make('moderatorid'),
Tables\Columns\TextColumn::make('reason'),
Tables\Columns\TextColumn::make('date'),
Tables\Columns\TextColumn::make('bantime'),
])
->filters([
//
])
->actions([
//
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
//
]),
]);
}

public function render(): View
{
return view('livewire.tables.ban-table');
}
}
problem is that when discord_id updates, my table doesn't update. How can i go about this?
2 Replies
krekas
krekas11mo ago
how you update discord_id?
DanielvdSpoel
DanielvdSpoel11mo ago
i already got it working by changing the component key
Want results from more Discord servers?
Add your server
More Posts