Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top