mercredi 15 novembre 2017

same slug for multiple language website in Laravel 5.5 [duplicate]

This question already has an answer here:

My laravel 5.5 project has 2 language (en and fr).

for each article, I write twice,one for fr,one for en

each article has an unique slug (but same slug for other language).

for eaxample:

http://ift.tt/2zE0dTh
http://ift.tt/2zZsm85 

I try validate it:

for store:

$validator = Validator::make($request->all(), [
    'slug' => 'nullable|unique:articles|max:250',

for update:

$validator = Validator::make($request->all(), [
'slug' => 'required|unique:articles,slug,'.$article->id.'|max:250',

you know with the top code,I could insert 'articleslug' only for one of languages.

Is it possible to check unique slug only for specific language?

here is my db table:

id /  title      /  text      / language / slug
1     en title     en test        en      articleslug
2     fr title     fr test       fr       articleslug
3     en title     en test       en      articleslug2
4     fr title     fr test       fr      articleslug2



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

Aucun commentaire:

Enregistrer un commentaire