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

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 Validation with multiple column

'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

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 :: get next month first day php 
Php :: do i need to install php after xampp 
Php :: woocommerce remove payment method when totla is 0 
Php :: codeigniter 4 query builder get inserted id 
Php :: file_put_contents 
Php :: laravel get file in public folder 
Php :: Add WooCommerce Price Suffix 
Php :: get ip address of client php 
Php :: phpunit assert not false 
Php :: show featured image in post wordpress 
Php :: php print array nice format 
Php :: add text next to price woocommerce 
Php :: laravel dump] 
Php :: csv utf-8 excel into php 
Php :: join array of strings php 
Php :: file form validation codeigniter 
Php :: laravel upload base64 image 
Php :: Malformed UTF-8 characters, possibly incorrectly encoded 
Php :: PHP str_split — Convert a string to an array 
Php :: General error: 1390 Prepared statement contains too many placeholders 
Php :: laravel log level 
Php :: Remove All Spaces Out of a String in PHP 
Php :: php check if string contains url 
Php :: phpmyadmin add foreign key 
Php :: how to display the database table names list in codeigniter 
Php :: php if elseif g 
Php :: get authinticated user id laravel 
Php :: named route with parameter laravel 
Php :: wp_list_pluck 
Php :: check website ssl certificate using php 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =