Set friendly names for validation attributes in Laravel 4

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);

Fest Contrapedal 2013

Ayer lanzamos junto a GRMN y todo el equipo de Contrapedal el sitio web del Fest, edición 2013.

Este será primer trabajo oficial bajo el nombre de MONTAG, proyecto que formamos junto a Germán.

Los invito a visitar el sitio, ver la programación y asistir a los espectáculos, el baratón, paneles e instalaciones:

Fest Contrapedal 2013




One line browser notepad

I found out this amazing tip the other day that turns a browser tab into a full size editable area. As the author said, many of us live on the browser. So having somewhere to jot down ideas/lists while browsing or programming without leaving “home” is great.

I started using this version, but the link below provides various flavours of the same “hack”. So, check it out if this doesn’t cut it for you ;)

data:text/html, <title>Quick Notes</title><body contenteditable style="font-size:2rem;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">

Jus paste this on your browser address bar.