LordJoo
Reactive textinputs is broken
class TaxonomiesResource extends Resource
{
protected static ?string $model = Taxonomy::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Section::make()->schema([
TextInput::make('name')
->autofocus()
->live()
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state)))
->required(),
TextInput::make('slug')
->columnSpan(1)
->required(),
])->columns(2),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')->searchable()->sortable(),
Tables\Columns\TextColumn::make('slug')->searchable()->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListTaxonomies::route('/'),
'create' => CreateTaxonomies::route('/create'),
'edit' => EditTaxonomies::route('/{record}/edit'),
];
}
}
8 replies