Register Service Provider and assign a Facade alias programmatically in Laravel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 

namespace MyPackage\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;

class MyPackageServiceProvider extends ServiceProvider
{
//...

public function register()
{
//set up facade
AliasLoader::getInstance()->alias('MyFacade', 'MyPackage\Facades\MyFacade');
}

//...
}

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×