You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✏️ Describe the bug
Adding the string type of a spatie/laravel-translatable property causes a must be of type ?string, array given, called in /var/www/html/vendor/spatie/laravel-data/src/Resolvers/DataFromArrayResolver.php on line 95 error.
<?phpnamespaceApp\Models;
useSpatie\Translatable\HasTranslations;
class LearningTopic extends Model
{
use HasTranslations;
publicarray$translatable = [
'title',
'content',
];
}
Use DTO in a controller: LearningTopicData::collect(LearningTopic::latest()->get()); Translatable fields are coming through as an array instead of a string:
✅ Expected behavior
Translatable fields should be a string.
✏️ Describe the bug
Adding the
string
type of aspatie/laravel-translatable
property causes amust be of type ?string, array given, called in /var/www/html/vendor/spatie/laravel-data/src/Resolvers/DataFromArrayResolver.php on line 95
error.↪️ To Reproduce
4: Eloquent Model
LearningTopicData::collect(LearningTopic::latest()->get());
Translatable fields are coming through as an array instead of a string:✅ Expected behavior
Translatable fields should be a string.
🖥️ Versions
Laravel: 11.21.0
Laravel Data: 4.8.1
Laravel Translatable: 6.8.0
PHP: 8.3.10
The text was updated successfully, but these errors were encountered: