Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel unique validation on multiple columns

'exam_category_id' => Rule::unique('exams')->where(function ($query) use ($request) {
   return $query->where('exam_name', $request->exam_name)
      ->where('exam_year', $request->exam_year)
      ->where('student_id', $request->student_id);
})
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #unique #validation #multiple #columns
ADD COMMENT
Topic
Name
7+5 =