F
Filament•7mo ago
Ringer

Access record from text input column in table

public static function table(Table $table): Table { return $table ->striped() ->columns([ Tables\Columns\TextInputColumn::make('name') ->rules(['required', 'min:1', 'max:255', function (string $attribute, $value, Closure $fail) { $itemManagerAction = app(ItemManagerAction::class); $name = "todo"; $itemCollectionId = 1; if (!$itemManagerAction->verifyItemIsNotDuplicate($name, $itemCollectionId, $value)) { $fail(__('name_already_used_attribute', ['name' => $value])); } }, ]) ... } I need to access the record to fill my $name and $itemCollectionId, how can I do this ? Thanks in advance
2 Replies
🤖transistor🤖
have you tried injecting the Model $record in here?:
function (string $attribute, $value, Closure $fail) {
function (string $attribute, $value, Closure $fail) {
Want results from more Discord servers?
Add your server