i have my database created using mySQl and ready to use but i can't tell laravel what is the foreign keys and what they reference i tried using this way
Schema::table('course', function (Blueprint $table) {
$table->foreign('weeklyHoursId')->references('id')->on('weekly_hours');
$table->foreign('gradeSystem')->references('id')->on('grade_system');
});
but it dosen't work for me and i still getting this error message
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`credithourssystem`.`#sql-2494_38`, CONSTRAINT `course_weeklyhoursid_foreign` FOREIGN KEY (`weeklyHoursId`) REFERENCES
weekly_hours
(id
)) (SQL: alter table course
add constraint course_weeklyhoursid_foreign
foreign key (weeklyHoursId
) references weekly_hours
(id
)) any help, please :)
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AwVPUI
via IFTTT
Aucun commentaire:
Enregistrer un commentaire