Tip: Laravel Facade

Quick (and dirty) tip:

Laravel makes use of Facades. Most classes with static access methods are examples of Facade implementations. Examples:

Auth::user()
App::make()
Config::get()

While Laravel has been in pre-beta (Edit: Now in official Beta), it's been very useful, and often necessary, to dig into the code and see what methods/variables are available. To do this, you often need to find what class is behind the Facade.

You can get this information with the get_class() method. You shouldn't attempt get_class() directly on a Facade, since it's effectively just a wrapper. You want to get the information on the class the Facade is "wrapping." You can do this via getFacadeRoot()

echo get_class( Auth::getFacadeRoot() ); // echos Illuminate\Auth\AuthManager
comments powered by Disqus