| facade | 类 |
服务容器绑定
|
|---|---|---|
| app | illuminate\foundation\application | app |
| artisan | illuminate\contracts\console\kernel | artisan |
| auth | illuminate\auth\authmanager | auth |
| auth (instance) | illuminate\auth\guard |
|
| blade | illuminate\view\compilers\bladecompiler | blade.compiler |
| bus | illuminate\contracts\bus\dispatcher |
|
| cache | illuminate\cache\repository | cache |
| config | illuminate\config\repository | config |
| cookie | illuminate\cookie\cookiejar | cookie |
| crypt | illuminate\encryption\encrypter | encrypter |
| db | illuminate\database\databasemanager | db |
| db (instance) | illuminate\database\connection |
|
| event | illuminate\events\dispatcher | events |
| file | illuminate\filesystem\filesystem | files |
| gate | illuminate\contracts\auth\access\gate |
|
| hash | illuminate\contracts\hashing\hasher | hash |
| input | illuminate\http\request | request |
| lang | illuminate\translation\translator | translator |
| log | illuminate\log\writer | log |
| illuminate\mail\mailer | mailer | |
| password | illuminate\auth\passwords\passwordbroker | auth.password |
| queue | illuminate\queue\queuemanager | queue |
| queue (instance) | illuminate\queue\queueinterface |
|
| queue (base class) | illuminate\queue\queue |
|
| redirect | illuminate\routing\redirector | redirect |
| redis | illuminate\redis\database | redis |
| request | illuminate\http\request | request |
| response | illuminate\contracts\routing\responsefactory |
|
| route | illuminate\routing\router | router |
| schema | illuminate\database\schema\blueprint |
|
| session | illuminate\session\sessionmanager | session |
| session (instance) | illuminate\session\store |
|
| storage | illuminate\contracts\filesystem\factory | filesystem |
| url | illuminate\routing\urlgenerator | url |
| validator | illuminate\validation\factory | validator |
| validator (instance) | illuminate\validation\validator |
|
| view | illuminate\view\factory | view |
| view (instance) | illuminate\view\view |
|
php artisan make:provider testfacadesserviceprovider
app/test/testfacades.php
<?php
namespace app\test;
class testfacades{
public function testingfacades(){
echo "testing the facades in laravel.";
}
}
app/test/facades/testfacades.php
<?php
namespace app\test\facades;
use illuminate\support\facades\facade;
class testfacades extends facade{
protected static function getfacadeaccessor() { return 'test'; }
}
app/providers/testfacadesserviceprovider.php
<?php
namespace app\providers;
use app;
use illuminate\support\serviceprovider;
class testfacadesserviceprovider extends serviceprovider {
public function boot() {
//
}
public function register() {
app::bind('test',function() {
return new \app\test\testfacades;
});
}
}
config/app.php
config/app.php
app/http/routes.php
route::get('/facadeex', function(){
return testfacades::testingfacades();
});
http://localhost:8000/facadeex



