2/24/2016 - 5:23 PM

Add new helper

Add new helper

Create a new file in your app/Helpers directory name it AnythingHelper.php An example of my helper is :

function getDomesticCities()
$result = \App\Package::where('type', '=', 'domestic')

return $result;

generate a service provider for your helper by following command

php artisan make:provider HelperServiceProvider

in the register function of your newly generated HelperServiceProvider.php add following code

require base_path().'/app/Helpers/AnythingHelper.php';

now in your config/app.php load this service provider and you are done



No, only above mentioned code does it, in your blade file do {{ yourHelperFunction('param') }}