Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel unique multiple columns

$table->unique(['mytext', 'user_id']);
Comment

laravel validation unique two columns

[
     'column_1' => 'required|unique:TableName,column_1,' . $this->id . ',id,colum_2,' . $this->column_2
]
Comment

unique check with multiple columns laravel validation

'name' => 'unique:table,field,NULL,id,field1,value1,field2,value2,field3,value3'
Comment

laravel unique validation on multiple columns

'mobile_no' 
  => 'unique:users,mobile_no,NULL,id,country_id,'.request('country_id');
Comment

laravel 8 validation unique 2 columns

// in my case, just add more unique rule
'phone1' =>'string|unique:tbl_users,phone1|unique:tbl_users,phone2|different:phone2|min:2',
'phone2' =>'string|unique:tbl_users,phone2|unique:tbl_users,phone1|different:phone1|min:2',
Comment

laravel validation two columns unique

$messages = [
    'data.ip.unique' => 'Given ip and hostname are not unique',
];

Validator::make($data, [
    'data.ip' => [
        'required',
        Rule::unique('servers')->where(function ($query) use($ip,$hostname) {
            return $query->where('ip', $ip)
            ->where('hostname', $hostname);
        }),
    ],
],
$messages
);
Comment

Laravel Unique Multiple Column validation

'name'        => 'required|max:150|unique:course_lessons,name,NULL,id,course_id,' . request('course_id'),
 "<input_filed_name>" => "valiadtionRule"|"ValidationRule"|"unique:<tableName>,<validateableField>,<ignoreableID>,<tablePrimaryKey>,<column1>,<column1Value>,<column2>,<column2Value>"
Comment

Laravel unique cheque using multiple column

public function rules()
{            
    return [
       'column_1' => 'required|unique:TableName,column_1,' . $this->id . ',id,colum_2,' . $this->column_2 . ',colum_3,' . $this->column_3,
    ];
}
Comment

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);
})
Comment

PREVIOUS NEXT
Code Example
Php :: sort an array in php manually 
Php :: count column eloquent laravel 
Php :: how to use attempt in laravel 
Php :: parse json phph 
Php :: acf wordpress loop through and display blog posts order by date and type 
Php :: model class not found in laravel 
Php :: nested for loop in php 
Php :: php apns notification source code 
Php :: Call to undefined function GuzzleHttp\_idn_uri_convert() 
Php :: how to save and get checkbox value in database php 
Php :: array to comma separated string php 
Php :: laravel controller constructor auth user null 
Php :: if home else php wordpress 
Php :: laravel blade if else condition 
Php :: Program for factorial of a number in php 
Php :: comment split une chaine de caratere en php 
Php :: drop foreign key laravel eloquent 
Php :: How to show total count in tables using php 
Php :: update url wordpress 
Php :: how do i know if file is empty in php 
Php :: laravel import xml to database 
Php :: laravel admin panel free package 
Php :: laravel model where in 
Php :: newline not working php 
Php :: if statement php 
Php :: laravel one to many relationship example 
Php :: time characters php 
Php :: laravel migration mediumint length 
Php :: select randomly from mysqli php 
Php :: php return associative array 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =