jeudi 23 mai 2019

how to add condition when i use unique function in validation in laravel framwork

good day , I have two data bases first data bsae contain table called product contain id,status,deleted second data base contain table called product contain id,id_product,name,price I use validateion rull uniq as below :

$this->validate($request,[
            'name'  =>'required|max:25|min:1|unique:mysql2.products,name|alpha',
            'price' =>'required'

            ]);

and it work good but if I want to make condition with uniqe function like below:

"select * from `product` where `name`=? AND `status`=? and `deleted `=?",array($name,1,1)

how I make uniqe dunction to accept condition like

`status`=? AND `deleted`=?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire