F
Filament3mo ago
Aminne

How i can translate the validation error message

I use filament language switcher plugin.
No description
Solution:
You can check a package like Laravel Lang: https://github.com/Laravel-Lang/lang...
GitHub
GitHub - Laravel-Lang/lang: List of 126 languages for Laravel Frame...
List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI. - Laravel-Lang/lang
Jump to solution
9 Replies
Dennis Koch
Dennis Koch3mo ago
Those should be default Laravel validation messages
Solution
Dennis Koch
Dennis Koch3mo ago
You can check a package like Laravel Lang: https://github.com/Laravel-Lang/lang
GitHub
GitHub - Laravel-Lang/lang: List of 126 languages for Laravel Frame...
List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI. - Laravel-Lang/lang
Aminne
Aminne3mo ago
Thank you so much i will check it. I use the plugin filament switcher it's useful for this case ?
Dennis Koch
Dennis Koch3mo ago
Filament switcher just switched the locale. You still need the translations
Aminne
Aminne3mo ago
okay i understand now, thank you. It works with this library, thank you this help so much .
Dennis Koch
Dennis Koch3mo ago
You're welcome
Aminne
Aminne3mo ago
I have a quickly question how i use eager loading for avoid N+1 problem this's my code
public function index(ListPostRequest $request)
{
$validated = $request->validated();
$posts = Post::with(['comments.user', 'categories', 'user'])
->where('status', 'published')->get();
return PostResource::collection($posts);
public function index(ListPostRequest $request)
{
$validated = $request->validated();
$posts = Post::with(['comments.user', 'categories', 'user'])
->where('status', 'published')->get();
return PostResource::collection($posts);
public function toArray(Request $request): array
{ 'categories'=> $this->categories,
'author' => [
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email
] }
public function toArray(Request $request): array
{ 'categories'=> $this->categories,
'author' => [
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email
] }
My eager loading is correct ?
Dennis Koch
Dennis Koch3mo ago
Not sure why you need comments.user but apart from that it looks good.
Aminne
Aminne3mo ago
I'm didn't provide all the code. Thank you for your help.
Want results from more Discord servers?
Add your server