Facades
原理
In the context of a Laravel application, a facade is a class that provides access to an object from the container. The machinery that makes this work is in theFacadeclass. Laravel's facades, and any custom facades you create, will extend the baseIlluminate\Support\Facades\Facadeclass.A facade class only needs to implement a single method:
getFacadeAccessor. It's the getFacadeAccessor method's job to define what to resolve from the container. TheFacadebase class makes use of the__callStatic()magic-method to defer calls from your facade to the resolved object.
简单来说,门面是通过一个魔术方法__callStatic()把静态方法映射到真正的方法上。
本文我们用Route来举例,
Route::get('/', function(){
#
}