Ad

Capitalized A Blade's Variable In Laravel

- 1 answer

I used to use smarty a lot and now moved on to Laravel but I'm missing something that was really useful. The modification in the template of you're variable.

Let say I have a variable assign as {{$var}}. Is there a way in Laravel to set it to upper case ? Something like: {{$var|upper}}

I sadly haven't found any documentation on it.

Ad

Answer

Only first character :

You could use UCFirst, a PHP function

{{ucfirst(trans('text.blabla'))}}

For the doc : http://php.net/manual/en/function.ucfirst.php


Whole word

Str::upper($value)

Also this page might have handy things : http://cheats.jesse-obrien.ca/

Ad
source: stackoverflow.com
Ad