Custom attributes returning empty string
Muhammadinaam opened this issue · comments
Muhammad Inaam Munir commented
Laravel: 8
spatie/laravel-translatable: 4.6.0
I have added text attribute to my model (see following code):
public function getTextAttribute()
{
return 'Name: ' . $this->name;
}
When I added use HasTranslations
to my model, $model->text
return "" empty string. Otherwise (without useHasTranslations), $model->text
works fine.
Muhammad Inaam Munir commented
Sorry, I was doing some mistakes.