jeudi 16 novembre 2017

update validation In laravel with unique check in multiple tables

In laravel with unique check in multiple tables, I do this for create new field:

 //store function

'slug' => 'required|unique:articles,slug|unique:zones,slug

It works well.

but what can I do for update?

I test this:

public function update(request $request, Sight $sight)
     {
       $validator = Validator::make($request->all(), [
         'slug' => 'unique:articles,slug,'.$sight->id.'|unique:zones,slug,'.$sight->id.'

But it allowed duplicate slug.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hucUFB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire