Search code examples
laravelmultilingualvoyager

laravel Voyager multilingual how to display items with translation in needed locale


Does anybody know how to display product's description in current language? I enabled multilingual in config/Voyager.php and I have read the doc's but I do not understand ( how to call products from table with translation for example i did like this $products = Product::withTranslation($locale)->get(); but this not working) clearly.


Solution

  • thx to God!!! I have found answer to my question!!! Just send locale to view from controller end write it before using your items
    if (Voyager::translatable($products)) { $products = $products->translate($locale, 'en'); }