Hi,
Currently we are using the Laravel's form request validation to verify that a user's email is unique to the users table:
'email' => 'required|email|unique:pgsql.schema.users'
We are using postgres and in order to connect to the appropriate schema we need to define the connection name as follows in the unique rule:
unique:[connection].[schema].[table]
We cannot leave out [connection], because then Laravel will assume the [schema] as the connection name, as described here:
https://laracasts.com/discuss/channels/laravel/controllervalidate-unique-specify-postgres-schema
However, our test kit which utilizes sqlite will have a different connection and no concept of schemas. I'm wondering where the best place is to override Laravel's Unique Validator to read the current environment and prefix the db name/schema to the unique rule so the form request rule can simply be:
'email' => 'required|email|unique:users'
but in reality it will behave like:
LIVE env
'email' => 'required|email|unique:pgsql.schema.users'
TEST env
'email' => 'required|email|unique:users' (unchanged)