I have a table GateAccess: id, person_id, gate_id, time_id. When adding a new record to this table I'd like to prevent adding several records with the same gate_id for one person_id. Gate_id must be unique for particular person_id.
I'd like to have table like this:
id, person_id, gate_id, time_id
1, 2, 1, 1
2, 2, 2, 2
but not the one:
id, person_id, gate_id, time_id
1, 2, 1, 1
2, 2, 1, 2
I have a validator:
$validator = Validator::make($data, [
'first_name' => 'required',
], $messages);
Can you help me to make rule for this validator?