I know this question has been asked before, but I have not received a corresponding answer.
I want to know how to write a rule for checking the uniqueness of two columns. I tried to write a rule like:
public $rules = array(
"event_id"=>"required",
"label"=>"required|unique:tblSection,label,event_id,$this->event_id",
"description"=>"required"
);
In my example, I need to check to ensure that one label can be unique for one event identifier, but can be used for another event identifier. For example, I want to achieve:
id event_id label description
1 1 demo testing
2 2 demo testing
In the rule defined above, I somehow need to pass the currently selected event_id so that it can check if a label exists in the database table for the selected event_id event, but I get a syntax error, for example:
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '\"'","file":"\/var\/www\/tamvote\/app\/modules\/sections\/models\/Sections.php","line":39}}
. - , , laravel 4, .