jeudi 24 mars 2016

laravel 5 Add unique constrain for a field that has the same foreign key id

I have an employee table which have name and id, and i have an employee_off_date table which have employee_id and date. I want to add a unique constrain for the date for employee id. For example, if employee_id 1 have date of 3/30/2016 another employee_id 1 can't have the same date of 3/30/2016 , but employee_id 2 can have date of 3/30/2016. Is there anyway i can do this in laravel 5 or mysql? or should i manually write this logic?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire