In laravel, when verifying whether fields are repeated, it is as follows
'email' => 'required|email|unique:users'
Verified unique:users
Queryusers
Whether there are duplicates in the table;
But this is a single database operation;
The current system needs to verify is not the database I want
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'hi_',
'strict' => false,
],
'mysql_card' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => 'hi_user',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'hi_',
'strict' => false,
],
Two databases are set up in the database configuration file;
I want to verify now mysql_card
this database
Can anyone give me some guidance?
The once and for all solution is to customize the validation rules:
This will be much more flexible.
My laravel tutorial column: /u/biaoyansu/blogs