I have field name built by laravel , when user enter his data like his name for example , after save , his name stored in the database as duplicate
Screenshot problem link: https://i.imgur.com/oYBgKYz.gifv
Please provide blade file and controller method.!
It seems like two requests are going to controller. Please check your code once.
Are you using both form and ajax requests.?
You can add unique in column in your migration.
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->string('username')->unique();
});
}
Manually Checking if the data exists before saving.
public function store(Request $request){
$is_exist = Model::where('username', $request->name)->first();
if($is_exist){
return 'EXISTING IN THE DATABASE, DONT SAVE.';
}else{
return 'NOT EXISTING IN THE DATABASE, YOU CAN SAVE.';
}
}