How to get the translated file from the Model

39 Views Asked by At

I have created a translatable model like following in a Custom Plugin Developed by me in OctoberCMS with Translate Plugin

public $implement = [ \RainLab\Translate\Behaviors\TranslatableModel::class];

 public $translatable = ['image'];

public $attachOne = [
        'image' =>  \System\Models\File::class,
];

I was able to add translated files using the Admin Backend, and I both see it in system_files.

But when I try to access the model like below, it always returns the file that is set for 'en' but nor 'fr'

$model->lang('fr');

0

There are 0 best solutions below