Welcome Guest, Not a member yet? Register   Sign In
Validation field label language
#5

Hi, that part haven't made it to the official user guide. But here's what it says in the development branch:

To use translated strings from language files, we can simply use the dot syntax. Let’s say we have a file with translations located here: app/Languages/en/Rules.php. We can simply use the language lines defined in this file, like this:

PHP Code:
$validation->setRules([
        'username' => [
            'label'  => 'Rules.username',
            'rules'  => 'required|is_unique[users.username]',
            'errors' => [
                'required' => 'Rules.username.required'
            ]
        ],
        'password' => [
            'label'  => 'Rules.password',
            'rules'  => 'required|min_length[10]',
            'errors' => [
                'min_length' => 'Rules.password.min_length'
            ]
        ]
    ]
); 
Reply


Messages In This Thread
Validation field label language - by maaa.om - 04-20-2020, 11:53 AM
RE: Validation field label language - by maaa.om - 04-22-2020, 06:56 AM
RE: Validation field label language - by jreklund - 04-22-2020, 10:20 AM
RE: Validation field label language - by maaa.om - 04-27-2020, 08:39 AM
RE: Validation field label language - by jreklund - 04-27-2020, 10:25 AM
RE: Validation field label language - by maaa.om - 04-27-2020, 10:40 AM
RE: Validation field label language - by Leo - 04-28-2020, 08:08 AM
RE: Validation field label language - by maaa.om - 04-30-2020, 12:59 PM
RE: Validation field label language - by jreklund - 04-27-2020, 10:50 AM
RE: Validation field label language - by michalsn - 04-30-2020, 01:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB