diff --git a/framework/core/src/Admin/Actions/IndexAction.php b/framework/core/src/Admin/Actions/IndexAction.php index da4701ec6..816e9d712 100644 --- a/framework/core/src/Admin/Actions/IndexAction.php +++ b/framework/core/src/Admin/Actions/IndexAction.php @@ -1,6 +1,6 @@ app['Flarum\Core\Support\Actor']); + BaseSerializer::setActor($this->app['Flarum\Support\Actor']); } /** @@ -29,6 +29,6 @@ class ApiServiceProvider extends ServiceProvider */ public function register() { - $this->app->singleton('Flarum\Core\Support\Actor'); + $this->app->singleton('Flarum\Support\Actor'); } } diff --git a/framework/core/src/Api/Middleware/LoginWithHeader.php b/framework/core/src/Api/Middleware/LoginWithHeader.php index e8e7f78cc..d3384b1ab 100644 --- a/framework/core/src/Api/Middleware/LoginWithHeader.php +++ b/framework/core/src/Api/Middleware/LoginWithHeader.php @@ -1,7 +1,7 @@ bus->dispatch($command); + } +} diff --git a/framework/core/src/Web/Actions/ConfirmAction.php b/framework/core/src/Forum/Actions/ConfirmAction.php similarity index 92% rename from framework/core/src/Web/Actions/ConfirmAction.php rename to framework/core/src/Forum/Actions/ConfirmAction.php index 510bfe7d7..61eecf602 100644 --- a/framework/core/src/Web/Actions/ConfirmAction.php +++ b/framework/core/src/Forum/Actions/ConfirmAction.php @@ -1,11 +1,11 @@ -with('title', Config::get('flarum::forum_title', 'Flarum Demo Forum')) - ->with('styles', app('flarum.web.assetManager')->getCSSFiles()) - ->with('scripts', app('flarum.web.assetManager')->getJSFiles()) + ->with('styles', app('flarum.forum.assetManager')->getCSSFiles()) + ->with('scripts', app('flarum.forum.assetManager')->getJSFiles()) ->with('config', $config) ->with('content', '') ->with('data', $data) diff --git a/framework/core/src/Web/Actions/LoginAction.php b/framework/core/src/Forum/Actions/LoginAction.php similarity index 86% rename from framework/core/src/Web/Actions/LoginAction.php rename to framework/core/src/Forum/Actions/LoginAction.php index 665e7e0c3..f4f55a7f3 100644 --- a/framework/core/src/Web/Actions/LoginAction.php +++ b/framework/core/src/Forum/Actions/LoginAction.php @@ -1,10 +1,10 @@ -loadViewsFrom($root.'/views', 'flarum.web'); + $this->loadViewsFrom($root.'/views', 'flarum.forum'); - $assetManager = $this->app['flarum.web.assetManager']; + $assetManager = $this->app['flarum.forum.assetManager']; $assetManager->addFile([ $root.'/ember/forum/dist/assets/vendor.js', @@ -37,7 +38,7 @@ class WebServiceProvider extends ServiceProvider */ public function register() { - $this->app['flarum.web.assetManager'] = $this->app->share(function ($app) { + $this->app['flarum.forum.assetManager'] = $this->app->share(function ($app) { return new AssetManager($app['files'], $app['path.public'].'/flarum', 'forum'); }); } diff --git a/framework/core/src/Web/Middleware/LoginWithCookie.php b/framework/core/src/Forum/Middleware/LoginWithCookie.php similarity index 88% rename from framework/core/src/Web/Middleware/LoginWithCookie.php rename to framework/core/src/Forum/Middleware/LoginWithCookie.php index e496ee133..0eaa71aae 100644 --- a/framework/core/src/Web/Middleware/LoginWithCookie.php +++ b/framework/core/src/Forum/Middleware/LoginWithCookie.php @@ -1,6 +1,6 @@ -app->make($class); + $request = $this->app['request']->instance(); + $parameters = $this->app['router']->current()->parameters(); + return $action->handle($request, $parameters); + }; +}; + +Route::group(['middleware' => 'Flarum\Forum\Middleware\LoginWithCookie'], function () use ($action) { + + Route::get('/', [ + 'as' => 'flarum.forum.index', + 'uses' => $action('Flarum\Forum\Actions\IndexAction') + ]); + + Route::get('logout', [ + 'as' => 'flarum.forum.logout', + 'uses' => $action('Flarum\Forum\Actions\LogoutAction') + ]); + +}); + +Route::post('login', [ + 'as' => 'flarum.forum.login', + 'uses' => $action('Flarum\Forum\Actions\LoginAction') +]); + +Route::get('confirm/{id}/{token}', [ + 'as' => 'flarum.forum.confirm', + 'uses' => $action('Flarum\Forum\Actions\ConfirmAction') +]); diff --git a/framework/core/src/Web/Actions/Action.php b/framework/core/src/Support/Action.php similarity index 60% rename from framework/core/src/Web/Actions/Action.php rename to framework/core/src/Support/Action.php index bccb78908..31599a950 100644 --- a/framework/core/src/Web/Actions/Action.php +++ b/framework/core/src/Support/Action.php @@ -1,9 +1,7 @@ -call($params); } - - protected function dispatch($command, $params = []) - { - event(new CommandWillBeDispatched($command, $params)); - return $this->bus->dispatch($command); - } } diff --git a/framework/core/src/Core/Support/Actor.php b/framework/core/src/Support/Actor.php similarity index 89% rename from framework/core/src/Core/Support/Actor.php rename to framework/core/src/Support/Actor.php index 46993ad5f..18e43ea43 100755 --- a/framework/core/src/Core/Support/Actor.php +++ b/framework/core/src/Support/Actor.php @@ -1,4 +1,4 @@ -app->make($class); - $request = $this->app['request']->instance(); - $parameters = $this->app['router']->current()->parameters(); - return $action->handle($request, $parameters); - }; -}; - -Route::group(['middleware' => 'Flarum\Web\Middleware\LoginWithCookie'], function () use ($action) { - - Route::get('/', [ - 'as' => 'flarum.index', - 'uses' => $action('Flarum\Web\Actions\IndexAction') - ]); - - Route::get('logout', [ - 'as' => 'flarum.logout', - 'uses' => $action('Flarum\Web\Actions\LogoutAction') - ]); - -}); - -Route::post('login', [ - 'as' => 'flarum.login', - 'uses' => $action('Flarum\Web\Actions\LoginAction') -]); - -Route::get('confirm/{id}/{token}', [ - 'as' => 'flarum.confirm', - 'uses' => $action('Flarum\Web\Actions\ConfirmAction') -]);