Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search on Translatable model #170

Open
donmbelembe opened this issue Jul 15, 2018 · 1 comment
Open

Search on Translatable model #170

donmbelembe opened this issue Jul 15, 2018 · 1 comment

Comments

@donmbelembe
Copy link

Someone can give me a hint for the scenario where my model is in two language, the default data is saved on the main model and the translated data is saved in a another model which store many translations of different models.

I would like to know how to implement search with this solution and also when someone is searching he can see only data of his language,

Thank you

@overbost
Copy link

overbost commented Sep 5, 2018

You must use the TranslationModel like other model, with "use Searchable", custom index, etc
Simple you must filter your searches because you have all language in one table:
App\Translation::search() ->match('name', $param) ->term('locale', \App::getLocale()) ->get();

in my opinion if you would add a lot of language and a lot of entry, you should split in different model/table the languages, because if you search 1 language in a table with 10 languages, the search method work with 10x items (only 1/10 needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants