Changing the style of a TextInput component dynamically

In my last job, I need to import a spreadsheet and compare the data from spreadsheet with my database. I want that when I open that imported line from spreadsheet, I can change the fields that are differents for better visualization. I already have it working, but I don´t know if I am in the best approach to solve the problem. I run the comparisons phase and populate a json column with the differences... And in every field I do this: Forms\Components\TextInput::make('cargo') ->label('Cargo') ->hint(function (Closure $get) { $difs = $get('diferencas'); return Arr::has($difs, 'cargo.nome') ? $difs['cargo.nome'] : ''; }) ->extraInputAttributes(function (Closure $get) { $difs = $get('diferencas'); if ( Arr::has($difs, 'cargo.nome') ) { return ['class' => 'ring-danger-500 ring-2']; } else {return [];} }, true) ->hintColor('danger') ->maxLength(255), Is there a way to rewrite this in a more optimized way ?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server