I changed the string in post.php in laravel (lang) directory, to change the language on the website
from
'search' => 'Search here...'
To
'search' => [
'placeholder' => 'Search here...',
'null' => 'Data not found'
],
after that an error occurs with the message
htmlspecialchars(): Argument #1 ($string) must be of type string, array given
if I restore it again everything works fine.
this is my blade.php
<input type="text" name="search" placeholder="{{ __('post.index.search.placeholder') }}">
blablabla
//for empty search request
<p>{{ __('post.index.search.null') }}</p>
help me!
Your post.php file in the lang directory should be like this. Whenever you are adding (.) in the __() function then make sure you have that properly structured in the language file. In your case, you have added post.index.search.placeholder, so you need to add a nested array in the language file.
return [
'index'=> [
'search' => [
'placeholder' => 'Search here...',
'null' => 'Data not found'
]
]
];
Check the screenshot