How create own class helper in Laravel? -
i need create own class methods, want call diverse controllers.
what should be: library, provider or helper in laravel?
1: create folder app/helpers
2: in app/providers
create new provider file helperserviceprovider.php
3: in file register helpers classes need
$this->app->bind('datehelper', function() { return new \app\helpers\datehelper; }); ... etc
4: in config/app.php add new provider
'app\providers\helperserviceprovider',
5: need create facade available use helper in view. find info how create facade on official laravel.com site
providers, can read doc
source: laravel forums
Comments
Post a Comment