문제

I'm trying to find path location of Redirect class. Its facade return 'redirect' in getFacadeAccessor method.

<?php namespace Illuminate\Support\Facades;

class Redirect extends Facade {

/**
 * Get the registered name of the component.
 *
 * @return string
 */
protected static function getFacadeAccessor() { return 'redirect'; }

}

However I found that the real file responsible for this class definition is the 'Redirector.php'. I can't find any where that alias 'Redirect' to 'Redirector' class so I am wondering how Laravel know about Redirector class is actually the Redirect component of container?

도움이 되었습니까?

해결책

Have a look inside /vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php. It contains a class RoutingServiceProvider that has a method registerRedirector().

That's where a new Redirector instance is injected into $app['redirect']. This can then be accessed via the Redirect facade you mentioned in your question.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top