Laravel words passed to Blade somehow become capitalized without explanation Laravel words passed to Blade somehow become capitalized without explanation laravel laravel

Laravel words passed to Blade somehow become capitalized without explanation


That's just how Form::label works. According to the documentation, if you want to get untouched output, you should use labels with two parameters like this:

{!! Form::label('email', 'e-mail address') !!}

Which outputs:

<label for="email">e-mail address</label>

In your first cutout you're passing just one parameter and Form::Label prettyfies this string, so:

{!! Form::label('my email'); !!}

Becomes this:

<label for="my email">My Email</label>

How it works

Label builder checks second parameter and if it doesn't exist or it's null, builder passes label $name to the formatLabel() method which uses ucwords() to capitalize every word's first character.

protected function formatLabel($name, $value)    {        return $value ?: ucwords(str_replace('_', ' ', $name));    }