Laravel – Creating a Helpers File
app/helpers.php.
//Helper
function sexByID($id)
{
if($id ==1) return ‘Male’;
else if($id ==2) return ‘Female’;
}
app\start\global.php :
// at the bottom of the file
require app_path().’/helpers.php’;
magic: $ composer dump-auto
<p >Sex: <b> {{trans(‘_.’.sexByID($user->sex))}}</b>
link, more info: http://laravel-recipes.com/recipes/50/creating-a-helpers-file