x-init="$watch('{{ $getState()->toISOString() }}', value => updateValues(new Date(value).getTime()))"
$form ->schema([ Forms\Components\TextInput::make('name') ->label('Name') ->required() ->placeholder('John Doe'), Forms\Components\TextInput::make('email') ->label('Email') ->required() ->placeholder('[email protected]'), Forms\Components\TextInput::make('password') ->label('Password') ->required() ->placeholder('********') ->password() ->autocomplete('new-password'), Forms\Components\Toggle::make('active') ->label('Ativo') ->default(true), Forms\Components\Toggle::make('is_admin') ->label('Admin') ->default(false) ->visible(fn (?Model $record) => $record?->id !== Auth::id()), // Add this component for the is_super condition Forms\Components\Toggle::make('is_super') ->label('Super User') ->default(false) ->hidden(fn (?Model $record) => $record?->is_super ?? false), // Hides the field for super users ]);
->filters([ Tables\Filters\Filter::make('Exclude Super Users') ->query(fn (Builder $query) => $query->where('is_super', false)) ->default(), // Applies by default ])
public static function query(): Builder{ // Filter users where is_super is false return parent::query()->where('is_super', false);}