mercredi 23 septembre 2015

laravel 5.1 custom validation message same field name

I have in my application fields with the same name accross my models. For example I have a "firstname" field in both User Model and Teacher Model. I am using validation and specified custom validation messages in Language files (by adding language folders and validation.php files inside resources/lang). Is there a way to return different messages for same field name? For example i would like to do something like the following

'custom' => [ 
                'user.firstname' => [
                       'required' => 'message',            
                 ],
                 'teacher.firstname' => [
                       'required' => 'different message',            
                 ],
            ],



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire