Restructure Flarum\Admin namespace

This commit is contained in:
Franz Liedke 2017-06-24 11:11:55 +02:00
parent 3517d4e86c
commit 0e2de95601
6 changed files with 34 additions and 15 deletions

View File

@ -55,13 +55,10 @@ class AdminServiceProvider extends AbstractServiceProvider
*/
protected function populateRoutes(RouteCollection $routes)
{
$route = $this->app->make(RouteHandlerFactory::class);
$factory = $this->app->make(RouteHandlerFactory::class);
$routes->get(
'/',
'index',
$route->toController(Controller\WebAppController::class)
);
$callback = include __DIR__.'/routes.php';
$callback($routes, $factory);
}
protected function flushWebAppAssetsWhenThemeChanged()
@ -91,6 +88,6 @@ class AdminServiceProvider extends AbstractServiceProvider
*/
protected function getWebAppAssets()
{
return $this->app->make(WebApp::class)->getAssets();
return $this->app->make(Frontend::class)->getAssets();
}
}

View File

@ -11,7 +11,7 @@
namespace Flarum\Admin\Controller;
use Flarum\Admin\WebApp;
use Flarum\Admin\Frontend;
use Flarum\Core\Permission;
use Flarum\Event\PrepareUnserializedSettings;
use Flarum\Extension\ExtensionManager;
@ -20,7 +20,7 @@ use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
class WebAppController extends AbstractWebAppController
class FrontendController extends AbstractWebAppController
{
/**
* @var SettingsRepositoryInterface
@ -33,12 +33,12 @@ class WebAppController extends AbstractWebAppController
protected $extensions;
/**
* @param WebApp $webApp
* @param Frontend $webApp
* @param Dispatcher $events
* @param SettingsRepositoryInterface $settings
* @param ExtensionManager $extensions
*/
public function __construct(WebApp $webApp, Dispatcher $events, SettingsRepositoryInterface $settings, ExtensionManager $extensions)
public function __construct(Frontend $webApp, Dispatcher $events, SettingsRepositoryInterface $settings, ExtensionManager $extensions)
{
$this->webApp = $webApp;
$this->events = $events;

View File

@ -13,7 +13,7 @@ namespace Flarum\Admin;
use Flarum\Http\WebApp\AbstractWebApp;
class WebApp extends AbstractWebApp
class Frontend extends AbstractWebApp
{
/**
* {@inheritdoc}

View File

@ -0,0 +1,22 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Admin\Controller;
use Flarum\Http\Handler\RouteHandlerFactory;
use Flarum\Http\RouteCollection;
return function (RouteCollection $map, RouteHandlerFactory $route) {
$map->get(
'/',
'index',
$route->toController(Controller\FrontendController::class)
);
};

View File

@ -11,7 +11,7 @@
namespace Flarum\Debug\Console;
use Flarum\Admin\WebApp as AdminWebApp;
use Flarum\Admin\Frontend as AdminWebApp;
use Flarum\Console\Command\AbstractCommand;
use Flarum\Forum\WebApp as ForumWebApp;
use Illuminate\Contracts\Cache\Store;
@ -29,7 +29,7 @@ class CacheClearCommand extends AbstractCommand
protected $forum;
/**
* @var \Flarum\Admin\WebApp
* @var \Flarum\Admin\Frontend
*/
protected $admin;

View File

@ -11,7 +11,7 @@
namespace Flarum\Event;
use Flarum\Admin\Controller\WebAppController as AdminWebAppController;
use Flarum\Admin\Controller\FrontendController as AdminWebAppController;
use Flarum\Forum\Controller\WebAppController as ForumWebAppController;
use Flarum\Http\Controller\AbstractWebAppController;
use Flarum\Http\WebApp\WebAppView;