I like it, especially because if you're using a helper class, because you can use a syntax like this:
<select>
{{ $formHelper->years(1997, 2007) }}
</select>
I think I'd still prefer using a macro.
HTML::macro('human_size', function($bytes)
{
$units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
for ($i = 0; $bytes > 1024; $i++) {
$bytes /= 1024;
}
return round($bytes, 2).' '.$units[$i];
});
and then calling
{{ HTML::human_size('123456789') }}
Maybe this will help you: http://howdoi.pl/how-do-i-create-helper-class-with-global-scope-in-laravel-4/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community