{"id":12414,"date":"2020-03-19T06:54:13","date_gmt":"2020-03-19T06:54:13","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=12414"},"modified":"2021-11-12T06:27:09","modified_gmt":"2021-11-12T06:27:09","slug":"laravel-error-integrity-constraint-violation-1062-duplicate-entry","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/laravel-error-integrity-constraint-violation-1062-duplicate-entry\/","title":{"rendered":"[SOLVED] Laravel Error: Integrity constraint violation: 1062 Duplicate entry"},"content":{"rendered":"\n<p>This Error is found when we insert duplicate data which already exist in the database. To overcome from it just make the key_name unique in Validation. <strong>See the below code:-<\/strong> <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"390\" height=\"155\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/03\/Integrity-constraint-violation-1062-Duplicate-entry.png\" alt=\"\" class=\"wp-image-12418\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/03\/Integrity-constraint-violation-1062-Duplicate-entry.png 390w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/03\/Integrity-constraint-violation-1062-Duplicate-entry-300x119.png 300w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/figure><\/div>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_44742\"><iframe loading=\"lazy\"  id=\"_ytid_47485\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_44742\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This Error is found when we insert duplicate data which already exist in the database. To overcome from it just make the key_name unique in Validation. See the below code:-<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5201],"tags":[5967,5969,5968,5203,5961,5965,5970],"class_list":["post-12414","post","type-post","status-publish","format-standard","hentry","category-laravel","tag-duplicate-entry","tag-insert-duplicate-data","tag-integrity-constraint-violation","tag-laravel","tag-laravel-error","tag-laravel-project","tag-validation"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=12414"}],"version-history":[{"count":6,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12414\/revisions"}],"predecessor-version":[{"id":24887,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12414\/revisions\/24887"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=12414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=12414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=12414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}