I'm making custom package and have problems with localized validation attribute output. How can I fix this problem? It returns post_localizations.en.post_title
instead of localized string Post title (EN)
I have input in my form:
<input type="text" name="post_localizations[ru][post_title]" />
And validations in my Controller is:
$this->validate($request, [
'post_localizations.*.post_title' => 'required|max:70'
], trans('namespace::validation'));
validation.php
in my package:
'attributes' => [
'post_localizations.*.post_title' => 'Post title (EN)'
]
Loading translations in in boot
method of the Provider:
$this->loadTranslationsFrom(
__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang', 'namespace');
All are works fine if I'm inserting my attribute to default laravel
resource/lang/en/validation.php
.
Also all are fine if string of input name simple like post_title
:
<input type="text" name="post_title" />
'attributes' => [
'post_title' => 'Post title'
]