xxxxxxxxxx
composer global require laravel/installer
laravel new example-app
xxxxxxxxxx
//Into the console
php artisan clear-compiled
php artisan config:cache
xxxxxxxxxx
//App\Providers\GlobalFunctionsServiceProvider.php
public function register()
{
require_once base_path().'/app/Functions/GlobalFunctions.php';
}
xxxxxxxxxx
//Into the console
php artisan make:provider GlobalFunctionsServiceProvider
xxxxxxxxxx
Composer //Autload whitin composer.json method
|
|--->Laravel App //My method
|
|--->Controller //Trait method
|--->Blade //Trait method
|--->Listener //Trait method
|--->
xxxxxxxxxx
//App\Config\App.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
App\Providers\GlobalFunctionsServiceProvider::class, //Add your service provider
xxxxxxxxxx
//Use your function anywhere within your Laravel app
first_function();
second_function();