gothinkster / laravel-realworld-example-app

Exemplary real world backend API built with Laravel
https://realworld.io
MIT License
1.2k stars 1.05k forks source link

Remove attributes from the language file #37

Open lhsazevedo opened 4 years ago

lhsazevedo commented 4 years ago

By default, Laravel's validation messages include the attribute name, contrary to the backend specification.

This was achieved by removing the first two words of each error message during runtime, instead of editing the language file directly. https://github.com/gothinkster/laravel-realworld-example-app/blob/86128fc60a020518c5956c3e4159dfe516fb12dd/app/Exceptions/Handler.php#L93-L99

Besides being unnecessary, this is a bad practice because, depending on the language, the name of the attribute will not necessarily be in the first two words.

The removal of attributes was even proposed by Laravel-Lang.