Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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

unique check two clolumn in laravel validation

'data.ip' => ['required', 'unique:servers,ip,'.$this->id.',NULL,id,hostname,'.$request->input('hostname')]
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

unique check two clolumn in laravel validation

'data.ip' => ['required', 'unique:servers,ip,'.$this->id.','.$request->input('id').',id,hostname,'.$request->input('hostname')]
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 :: heroku deploy php 
Php :: Edit PHP INI 
Php :: find in associative array php by property value 
Php :: install pdo mysql in alpine-apache php 5.6 
Php :: string to array php 
Php :: php configuration file location in centos 8 
Php :: status code 301 
Php :: php infinite loop 
Php :: cideigniter orLike() 
Php :: Route [login] not defined.Route [login] not defined. 
Php :: How to check if a session is expired or never was set in php 
Php :: Pure Intersection Types - PHP 8.1 
Php :: sometimes validation in laravel 
Php :: php object example 
Php :: Laravel Unique Multiple Column validation 
Php :: php Undefined index: error 
Php :: square root 
Php :: php config file 
Php :: php sum array values by key 
Php :: Laravel artisan command to create model plus migration 
Php :: laravel search function 
Php :: only get selected value from has many ralation laravel 
Php :: twig render to string 
Php :: What template files are used for our custom post type in wordpress? 
Php :: ignore user id on email validation laravel 
Php :: php check new month 
Php :: crud operations in php 
Php :: Laravel factory creating tempory data 
Php :: country list laravel 
Php :: how to append an array into associative array 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =