Created
December 9, 2016 16:38
-
-
Save YavorK/0b24ace3000cc70b94515954ff6dc11a to your computer and use it in GitHub Desktop.
Helpers file from a "random" Laravel project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Route; | |
function path_to_user_profile_image($filename) | |
{ | |
if ($filename != '') { | |
return url('img/children/' . $filename); | |
} | |
return url('img/default_child.png'); | |
} | |
function path_to_user_profile_retina_image($filename) | |
{ | |
if ($filename != '') { | |
return url('img/children/retina_' . $filename); | |
} | |
return url('img/default_child.png'); | |
} | |
function path_to_dish_image($filename) | |
{ | |
if (empty($filename)) { | |
return url('img/default.png'); | |
} | |
return url('img/dishes/' . $filename); | |
} | |
function path_to_dish_retina_image($filename) | |
{ | |
if (empty($filename)) { | |
return url('img/default.png'); | |
} | |
return url('img/dishes/retina_' . $filename); | |
} | |
function getClassIfActive($route) | |
{ | |
if (Route::currentRouteName() == $route) { | |
return 'active'; | |
} else { | |
return ''; | |
} | |
} | |
function t($key) | |
{ | |
return trans($key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment