Last active
July 12, 2017 12:32
-
-
Save bpocallaghan/f8b6f21e352b57a8f07f08fea2965384 to your computer and use it in GitHub Desktop.
Laravel 5 Include Helper Files
This file contains 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
"autoload": { | |
"files": [ | |
"app/Helpers/helpers.php", | |
], | |
"psr-4": { | |
"App\\": "app/", | |
} | |
}, |
This file contains 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 | |
// save app/Providers/ | |
// remember to register it in your config/app.php | |
// 'providers' => [ | |
// App\Providers\HelperServiceProvider::class, | |
// ] | |
// lastly run composer dump-autoload | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class HelperServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register the application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
foreach (glob(base_path() . '/app/Helpers/*.php') as $filename) { | |
require_once $filename; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment