voyager: Multilinugal translations not working

Version information

  • Laravel: v5.6.39
  • Voyager: v1.1.11
  • PHP: 7.2
  • Database: mysql Ver 14.14 Distrib 5.7.24,

Description

I want to use Multilanguage feature. I followed exact steps mentioned in documentation here https://docs.laravelvoyager.com/core-concepts/multilanguage

But it doesn’t provide translations in result set.

I have a table named practice_areas Here is the model PracticeArea:

namespace App;

use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Traits\Translatable;

class PracticeArea extends Model
{
    use Translatable;

    protected $translatable = ['name', 'description', 'slug'];

    protected $table = 'practice_areas';

    protected $guarded = ['id'];
}

The configurations in config/voyager.php:

    'multilingual' => [
        /*
         * Set whether or not the multilingual is supported by the BREAD input.
         */
        'enabled' => true,

        /*
         * Set whether or not the admin layout default is RTL.
         */
        'rtl' => false,

        /*
         * Select default language
         */
        'default' => 'en',

        /*
         * Select languages that are supported.
         */
        'locales' => [
            'en',
            'es',
        ],
    ],

Here is the translations table: translations-table

And it contains the translations for Practice Area id 1. translation-records

But when i try to fetch Practice Areas with Translations, it doesn’t provide translations in result set. dd-result

Am i missing something or doing something wrong. Some help will be much appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22

Most upvoted comments

Glad to see you figured it out @nathan-io. Good find