🐷
【いいね機能】 postでのエラー 存在しないidを登録できない
Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`sample`.`likes`, CONSTRAINT `likes_music_file_id_foreign` FOREIGN KEY (`music_file_id`) REFERENCES `music_files` (`id`)) (SQL: insert into `likes` (`user_id`, `music_file_id`, `updated_at`, `created_at`) values (1, 2, 2021-08-16 00:52:32, 2021-08-16 00:52:32)) in file /var/www/html/src/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669
解決
Discussion