TypiCMS/Base

Cannot translate attribute `title` as it's not one of the translatable attributes: `status`

bibekstan opened this issue · 2 comments

I have created a custom module named Newletters where it has only email and status field. However the scaffolding generated by typicms has title, slug, status, body, summary as translatable by default in the model. Now when I tried to remove these unwanted field from $translatable attribute in the model, it gives me the error:
Cannot translate attribute title as it's not one of the translatable attributes: status

By default it has:
public $translatable = [
'title',
'slug',
'status',
'summary',
'body',
];

But I want:
public $translatable = [
'status',
];

Please have a look at the package documentation or the Laravel one as this is not strictly related to TypiCMS.

@sdebacker
The scaffolding auto sets up an observer to check for title and slug to be translatable items while creating a record. So, if you dont need the title and slug to be checked while creating the rows, you can comment or remove the observer Module/MyModule/Providers/ModuleServiceProvider.php file.
The observer looks like:
MyModule::observe(new SlugObserver());
Need to comment this line