How can i translate the attribute, now the output is: companyname is verplicht. (dutch)
Validation.php
'required' => ':attribute is verplicht.',
Controller:
$rules = array(
'companyname' => 'required'
;
View:
{{ Form::text( 'companyname' , null, array( 'class' => 'form-control' ) ) ) }}
Laravel 5 Translation Using the Double Underscore (__) Helper Function. The __ helper function can be used to retrieve lines of text from language files.
Laravel-lang is a collection of over 68 language translations for Laravel by developer Fred Delrieu (caouecs), including authentication, pagination, passwords, and validation rules. This package also includes JSON files for many languages.
The bail validation rule applies to a "multi-rule" attribute. It does not stop running validation for other attributes. From the documentation: $request->validate([ 'title' => 'bail|required|unique:posts|max:255', 'body' => 'required', ]);
You need to edit the app/resources/lang/your-language/validation.php and at the bottom you will see an attribute array.
Following your example just add:
'attributes' => [
'companyname' => 'Your Custom Name'
],
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With