There are tons of static site generators. However, Jigsaw has been catching some wind. So, what stands out with it?
- Blade templating system “just like your Laravel apps.”
- Laravel Mix, Browsersync integration.
- Familiarity with Laravel ecosystem.
The problem we were trying to solve is that local news sites are mostly hard to read, hard to skim through and cluttered with ads. Also, it would be cool to have all news sources in a timeline fashion. Although you could certainly achieve this last feature using a regular feed reader.
So after a few iterations and proof of concepts, we put together a few components that make the whole app: a Laravel 5 backend for administering news and news sources, a spider that crawls news sources every 5 minutes and dumps them into our database, and a beautifully readable front-end.
Apart from Laravel 5, we’re using:
The app is mainly done, although we keep a Trello board full of features to evaluate and implement. Some of them include some e-mailing, basic search, real-time refresh, automated testing and of course some refactoring.
I just lost half an hour on this, so I figured I’d help you save some precious time.
Every search on Google returned info on how to specify custom messages, which is nicely documented, but there’s currently nothing about friendly names on attributes on the docs.
After searching on Google, roaming through Laravel’s code and trying almost everything, I got to this comment on GitHub.
You may call setAttributeNames on a Validator instance now.
So, for example’s sake:
$rules = array( 'username' => 'required|min:8|unique:users|integer', 'firstname' => 'required', 'lastname' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed' ); $messages = array( 'required' => 'El campo :attribute es obligatorio.', 'email.required' => 'El campo de :attribute es requerido y debe ser una dirección válida.', 'validation.confirmed' => 'Las contraseñas no coinciden.' ); $friendly_names = array( 'firstname' => 'Nombre', 'lastname' => 'Apellido' ); $validator = Validator::make(Input::all(), $rules, $messages); $validator->setAttributeNames($friendly_names);