Unique to check array field
'->unique(Employee::class, 'details.email_id') can we use array as a field'
7 Replies
i dont think laravel supports that no
'Field::make('email')->unique(ignorable: $ignoredUser) how to use this in resources means what mention in the $ignoreduser,Sometimes, you may wish to ignore a given model during unique validation. For example, consider an "update profile" form that includes the user's name, email address, and location. You will probably want to verify that the email address is unique. However, if the user only changes the name field and not the email field, you do not want a validation error to be thrown because the user is already the owner of the email address in question'
instead try unique(ignoreRecord: true)
okay
'I tired its coming but I need validation.unique can we customize it'
probably missing laravel validation translations in your /lang folder
i used both this TextInput::make('slug')
->label('Kheltag Slug')
->unique(table: static::$model, ignorable: fn ($record) => $record)
and
->unique(ignoreRecord: true)
Both did not work
whats not working
please open a new thread with information