Posts

Showing posts from September, 2016

How to create custom class or helpers in Laravel 5.*

For create a custom class or helpers or functions in laravel just follow below steps. I Created Libraries directory under app directory . Where i will put my all custom classes or helpers functions. Right now i create a Helpers Class under Libraries directory app/Libraries/Helpers.php <?php namespace App \ Libraries ; class Helpers { public static function test () { return "Test" ; } }   ?> Now I will create a new service provider for autoload all files under libraries directory. hit below command in terminal or create a new class LibrariesProvider under app/Providers directory. php artisan make : provider LibrariesProvider Now  my app/Providers/LibrariesProvide.php is as below: <?php namespace App \ Providers ; use Illuminate \ Support \ ServiceProvider ; class LibrariesProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot () { // }