mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
RouteHandlerFactory: Refactor frontend parameter
By passing in just the frontend identifier, we can hide some of the implementation details, in this case the identifier of the Frontend instance in the IoC container.
This commit is contained in:
parent
7989f84299
commit
f5d3ab0da2
|
@ -46,7 +46,7 @@ class RouteHandlerFactory
|
||||||
public function toFrontend(string $frontend, string $content = null)
|
public function toFrontend(string $frontend, string $content = null)
|
||||||
{
|
{
|
||||||
return $this->toController(function (Container $container) use ($frontend, $content) {
|
return $this->toController(function (Container $container) use ($frontend, $content) {
|
||||||
$frontend = $container->make($frontend);
|
$frontend = $container->make("flarum.$frontend.frontend");
|
||||||
|
|
||||||
if ($content) {
|
if ($content) {
|
||||||
$frontend->add($container->make($content));
|
$frontend->add($container->make($content));
|
||||||
|
@ -62,7 +62,7 @@ class RouteHandlerFactory
|
||||||
*/
|
*/
|
||||||
public function toForum(string $content = null)
|
public function toForum(string $content = null)
|
||||||
{
|
{
|
||||||
return $this->toFrontend('flarum.forum.frontend', $content);
|
return $this->toFrontend('forum', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,6 +71,6 @@ class RouteHandlerFactory
|
||||||
*/
|
*/
|
||||||
public function toAdmin(string $content = null)
|
public function toAdmin(string $content = null)
|
||||||
{
|
{
|
||||||
return $this->toFrontend('flarum.admin.frontend', $content);
|
return $this->toFrontend('admin', $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user