l33tneko
l33tneko
FFilament
Created by l33tneko on 9/26/2023 in #❓┊help
Problem with rows that have null values
Table definition
public function table(Table $table): Table
{
return $table
->query((new Query())->get())
->filters([
(new Filters())->getStructureTrainerGroupFilter()
])
->columns([
Tables\Columns\TextColumn::make('user.full_name')->label('Фамилия, Имя, Отчество')->searchable(),
Tables\Columns\SelectColumn::make('kyudan.place')
->options(Kyudans::LIST)
->label('Стилевая квалификация')
->updateStateUsing(function (string $state, Sportsman $record): ?string {
$this->kyudans[$record->id]['number'] = $state;
return $state;
}),
Tables\Columns\TextInputColumn::make('kyudan.certificate_number')
->label('Номер сертификата')
])
->recordClasses(function (Sportsman $record) {
$isKyudanExists = $record->kyudan()->exists();
if ($isKyudanExists)
{
return 'bg-yellow-100';
}
return null;
});
}
public function table(Table $table): Table
{
return $table
->query((new Query())->get())
->filters([
(new Filters())->getStructureTrainerGroupFilter()
])
->columns([
Tables\Columns\TextColumn::make('user.full_name')->label('Фамилия, Имя, Отчество')->searchable(),
Tables\Columns\SelectColumn::make('kyudan.place')
->options(Kyudans::LIST)
->label('Стилевая квалификация')
->updateStateUsing(function (string $state, Sportsman $record): ?string {
$this->kyudans[$record->id]['number'] = $state;
return $state;
}),
Tables\Columns\TextInputColumn::make('kyudan.certificate_number')
->label('Номер сертификата')
])
->recordClasses(function (Sportsman $record) {
$isKyudanExists = $record->kyudan()->exists();
if ($isKyudanExists)
{
return 'bg-yellow-100';
}
return null;
});
}
3 replies
FFilament
Created by l33tneko on 8/15/2023 in #❓┊help
Refresh table in livewire component
View
<label class="label cursor-pointer w-fit">
<span class="label-text">Deleted sportsmen</span>
<input class="checkbox ml-4" type="checkbox" wire:model.live="deletedSportsmen">
</label>
<label class="label cursor-pointer w-fit">
<span class="label-text">Deleted sportsmen</span>
<input class="checkbox ml-4" type="checkbox" wire:model.live="deletedSportsmen">
</label>
6 replies
FFilament
Created by l33tneko on 8/15/2023 in #❓┊help
Refresh table in livewire component
Component
class Sportsmen extends Component implements HasTable, HasForms
{
use InteractsWithTable;
use InteractsWithForms;

public bool $deletedSportsmen = false;

public function table(Table $table): Table
{
return $table
->query(SportsmanQuery::make(active: !$this->deletedSportsmen)->execute())
->columns([/* Columns */])
}
}
class Sportsmen extends Component implements HasTable, HasForms
{
use InteractsWithTable;
use InteractsWithForms;

public bool $deletedSportsmen = false;

public function table(Table $table): Table
{
return $table
->query(SportsmanQuery::make(active: !$this->deletedSportsmen)->execute())
->columns([/* Columns */])
}
}
6 replies