mirror of
https://github.com/flarum/core.git
synced 2025-07-18 07:11:17 +02:00
Refactor Flarum\Web and Flarum\Admin
- In order to be consistent with the Ember/LESS naming scheme, renamed Flarum\Web to Flarum\Forum. - Moved common classes into Flarum\Support so that Flarum\Admin doesn’t depend on Flarum\Forum. Also moved Actor into Flarum\Support as it doesn’t belong in the domain.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php namespace Flarum\Admin\Actions;
|
<?php namespace Flarum\Admin\Actions;
|
||||||
|
|
||||||
use Flarum\Web\Actions\Action;
|
use Flarum\Support\Action;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Session;
|
use Session;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php namespace Flarum\Admin;
|
<?php namespace Flarum\Admin;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Flarum\Web\AssetManager;
|
use Flarum\Support\AssetManager;
|
||||||
|
|
||||||
class AdminServiceProvider extends ServiceProvider
|
class AdminServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php namespace Flarum\Admin\Middleware;
|
<?php namespace Flarum\Admin\Middleware;
|
||||||
|
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Core\Models\AccessToken;
|
use Flarum\Core\Models\AccessToken;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use Flarum\Core\Repositories\UserRepositoryInterface;
|
use Flarum\Core\Repositories\UserRepositoryInterface;
|
||||||
use Flarum\Core\Repositories\ActivityRepositoryInterface;
|
use Flarum\Core\Repositories\ActivityRepositoryInterface;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Serializers\ActivitySerializer;
|
use Flarum\Api\Serializers\ActivitySerializer;
|
||||||
|
@@ -3,10 +3,10 @@
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Contracts\Bus\Dispatcher;
|
use Illuminate\Contracts\Bus\Dispatcher;
|
||||||
use Tobscure\JsonApi\Document;
|
use Tobscure\JsonApi\Document;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Events\CommandWillBeDispatched;
|
use Flarum\Api\Events\CommandWillBeDispatched;
|
||||||
use Flarum\Api\Events\WillRespondWithDocument;
|
use Flarum\Api\Events\WillRespondWithDocument;
|
||||||
use Flarum\Web\Actions\Action;
|
use Flarum\Support\Action;
|
||||||
use Config;
|
use Config;
|
||||||
use App;
|
use App;
|
||||||
use Response;
|
use Response;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use Flarum\Core\Search\Discussions\DiscussionSearchCriteria;
|
use Flarum\Core\Search\Discussions\DiscussionSearchCriteria;
|
||||||
use Flarum\Core\Search\Discussions\DiscussionSearcher;
|
use Flarum\Core\Search\Discussions\DiscussionSearcher;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Serializers\DiscussionSerializer;
|
use Flarum\Api\Serializers\DiscussionSerializer;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php namespace Flarum\Api\Actions\Discussions;
|
<?php namespace Flarum\Api\Actions\Discussions;
|
||||||
|
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Core\Repositories\DiscussionRepositoryInterface as DiscussionRepository;
|
use Flarum\Core\Repositories\DiscussionRepositoryInterface as DiscussionRepository;
|
||||||
use Flarum\Core\Repositories\PostRepositoryInterface as PostRepository;
|
use Flarum\Core\Repositories\PostRepositoryInterface as PostRepository;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php namespace Flarum\Api\Actions\Notifications;
|
<?php namespace Flarum\Api\Actions\Notifications;
|
||||||
|
|
||||||
use Flarum\Core\Repositories\NotificationRepositoryInterface;
|
use Flarum\Core\Repositories\NotificationRepositoryInterface;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Core\Exceptions\PermissionDeniedException;
|
use Flarum\Core\Exceptions\PermissionDeniedException;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Flarum\Core\Repositories\PostRepositoryInterface;
|
use Flarum\Core\Repositories\PostRepositoryInterface;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Serializers\PostSerializer;
|
use Flarum\Api\Serializers\PostSerializer;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Flarum\Core\Repositories\PostRepositoryInterface;
|
use Flarum\Core\Repositories\PostRepositoryInterface;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Serializers\PostSerializer;
|
use Flarum\Api\Serializers\PostSerializer;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use Flarum\Core\Search\Users\UserSearchCriteria;
|
use Flarum\Core\Search\Users\UserSearchCriteria;
|
||||||
use Flarum\Core\Search\Users\UserSearcher;
|
use Flarum\Core\Search\Users\UserSearcher;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Serializers\UserSerializer;
|
use Flarum\Api\Serializers\UserSerializer;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php namespace Flarum\Api\Actions\Users;
|
<?php namespace Flarum\Api\Actions\Users;
|
||||||
|
|
||||||
use Flarum\Core\Repositories\UserRepositoryInterface;
|
use Flarum\Core\Repositories\UserRepositoryInterface;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Api\Actions\ApiParams;
|
use Flarum\Api\Actions\ApiParams;
|
||||||
use Flarum\Api\Actions\BaseAction;
|
use Flarum\Api\Actions\BaseAction;
|
||||||
use Flarum\Api\Serializers\UserSerializer;
|
use Flarum\Api\Serializers\UserSerializer;
|
||||||
|
@@ -19,7 +19,7 @@ class ApiServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
include __DIR__.'/routes.php';
|
include __DIR__.'/routes.php';
|
||||||
|
|
||||||
BaseSerializer::setActor($this->app['Flarum\Core\Support\Actor']);
|
BaseSerializer::setActor($this->app['Flarum\Support\Actor']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +29,6 @@ class ApiServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->singleton('Flarum\Core\Support\Actor');
|
$this->app->singleton('Flarum\Support\Actor');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php namespace Flarum\Api\Middleware;
|
<?php namespace Flarum\Api\Middleware;
|
||||||
|
|
||||||
use Flarum\Core\Models\AccessToken;
|
use Flarum\Core\Models\AccessToken;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
class LoginWithHeader
|
class LoginWithHeader
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
use Tobscure\JsonApi\SerializerAbstract;
|
use Tobscure\JsonApi\SerializerAbstract;
|
||||||
use Flarum\Api\Events\SerializeAttributes;
|
use Flarum\Api\Events\SerializeAttributes;
|
||||||
use Flarum\Api\Events\SerializeRelationship;
|
use Flarum\Api\Events\SerializeRelationship;
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,14 +14,14 @@ abstract class BaseSerializer extends SerializerAbstract
|
|||||||
/**
|
/**
|
||||||
* The actor who is requesting the serialized objects.
|
* The actor who is requesting the serialized objects.
|
||||||
*
|
*
|
||||||
* @var \Flarum\Core\Support\Actor
|
* @var \Flarum\Support\Actor
|
||||||
*/
|
*/
|
||||||
protected static $actor;
|
protected static $actor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the actor who is requesting the serialized objects.
|
* Set the actor who is requesting the serialized objects.
|
||||||
*
|
*
|
||||||
* @param \Flarum\Core\Support\Actor $actor
|
* @param \Flarum\Support\Actor $actor
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function setActor(Actor $actor)
|
public static function setActor(Actor $actor)
|
||||||
|
13
framework/core/src/Forum/Actions/BaseAction.php
Normal file
13
framework/core/src/Forum/Actions/BaseAction.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
|
use Flarum\Support\Action;
|
||||||
|
use Flarum\Forum\Events\CommandWillBeDispatched;
|
||||||
|
|
||||||
|
abstract class BaseAction extends Action
|
||||||
|
{
|
||||||
|
protected function dispatch($command, $params = [])
|
||||||
|
{
|
||||||
|
event(new CommandWillBeDispatched($command, $params));
|
||||||
|
return $this->bus->dispatch($command);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,11 +1,11 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Flarum\Core\Commands\ConfirmEmailCommand;
|
use Flarum\Core\Commands\ConfirmEmailCommand;
|
||||||
use Flarum\Core\Commands\GenerateAccessTokenCommand;
|
use Flarum\Core\Commands\GenerateAccessTokenCommand;
|
||||||
use Flarum\Core\Exceptions\InvalidConfirmationTokenException;
|
use Flarum\Core\Exceptions\InvalidConfirmationTokenException;
|
||||||
|
|
||||||
class ConfirmAction extends Action
|
class ConfirmAction extends BaseAction
|
||||||
{
|
{
|
||||||
use MakesRememberCookie;
|
use MakesRememberCookie;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -7,7 +7,7 @@ use Cookie;
|
|||||||
use Config;
|
use Config;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
class IndexAction extends Action
|
class IndexAction extends BaseAction
|
||||||
{
|
{
|
||||||
public function handle(Request $request, $params = [])
|
public function handle(Request $request, $params = [])
|
||||||
{
|
{
|
||||||
@@ -43,10 +43,10 @@ class IndexAction extends Action
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return View::make('flarum.web::index')
|
return View::make('flarum.forum::index')
|
||||||
->with('title', Config::get('flarum::forum_title', 'Flarum Demo Forum'))
|
->with('title', Config::get('flarum::forum_title', 'Flarum Demo Forum'))
|
||||||
->with('styles', app('flarum.web.assetManager')->getCSSFiles())
|
->with('styles', app('flarum.forum.assetManager')->getCSSFiles())
|
||||||
->with('scripts', app('flarum.web.assetManager')->getJSFiles())
|
->with('scripts', app('flarum.forum.assetManager')->getJSFiles())
|
||||||
->with('config', $config)
|
->with('config', $config)
|
||||||
->with('content', '')
|
->with('content', '')
|
||||||
->with('data', $data)
|
->with('data', $data)
|
@@ -1,10 +1,10 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Flarum\Web\Events\UserLoggedIn;
|
use Flarum\Forum\Events\UserLoggedIn;
|
||||||
use Flarum\Core\Repositories\UserRepositoryInterface;
|
use Flarum\Core\Repositories\UserRepositoryInterface;
|
||||||
|
|
||||||
class LoginAction extends Action
|
class LoginAction extends BaseAction
|
||||||
{
|
{
|
||||||
use MakesRememberCookie;
|
use MakesRememberCookie;
|
||||||
|
|
@@ -1,10 +1,10 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Flarum\Web\Events\UserLoggedOut;
|
use Flarum\Forum\Events\UserLoggedOut;
|
||||||
use Cookie;
|
use Cookie;
|
||||||
|
|
||||||
class LogoutAction extends Action
|
class LogoutAction extends BaseAction
|
||||||
{
|
{
|
||||||
public function handle(Request $request, $params = [])
|
public function handle(Request $request, $params = [])
|
||||||
{
|
{
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Forum\Actions;
|
||||||
|
|
||||||
use Cookie;
|
use Cookie;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web\Events;
|
<?php namespace Flarum\Forum\Events;
|
||||||
|
|
||||||
class CommandWillBeDispatched
|
class CommandWillBeDispatched
|
||||||
{
|
{
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web\Events;
|
<?php namespace Flarum\Forum\Events;
|
||||||
|
|
||||||
use Flarum\Core\Models\User;
|
use Flarum\Core\Models\User;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web\Events;
|
<?php namespace Flarum\Forum\Events;
|
||||||
|
|
||||||
use Flarum\Core\Models\User;
|
use Flarum\Core\Models\User;
|
||||||
|
|
@@ -1,8 +1,9 @@
|
|||||||
<?php namespace Flarum\Web;
|
<?php namespace Flarum\Forum;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Flarum\Support\AssetManager;
|
||||||
|
|
||||||
class WebServiceProvider extends ServiceProvider
|
class ForumServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Bootstrap the application events.
|
* Bootstrap the application events.
|
||||||
@@ -13,9 +14,9 @@ class WebServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$root = __DIR__.'/../..';
|
$root = __DIR__.'/../..';
|
||||||
|
|
||||||
$this->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([
|
$assetManager->addFile([
|
||||||
$root.'/ember/forum/dist/assets/vendor.js',
|
$root.'/ember/forum/dist/assets/vendor.js',
|
||||||
@@ -37,7 +38,7 @@ class WebServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function register()
|
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');
|
return new AssetManager($app['files'], $app['path.public'].'/flarum', 'forum');
|
||||||
});
|
});
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
<?php namespace Flarum\Web\Middleware;
|
<?php namespace Flarum\Forum\Middleware;
|
||||||
|
|
||||||
use Flarum\Core\Support\Actor;
|
use Flarum\Support\Actor;
|
||||||
use Flarum\Core\Models\AccessToken;
|
use Flarum\Core\Models\AccessToken;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Closure;
|
use Closure;
|
34
framework/core/src/Forum/routes.php
Executable file
34
framework/core/src/Forum/routes.php
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$action = function ($class) {
|
||||||
|
return function () use ($class) {
|
||||||
|
$action = $this->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')
|
||||||
|
]);
|
@@ -1,9 +1,7 @@
|
|||||||
<?php namespace Flarum\Web\Actions;
|
<?php namespace Flarum\Support;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Contracts\Bus\Dispatcher;
|
use Illuminate\Contracts\Bus\Dispatcher;
|
||||||
use Flarum\Web\Events\CommandWillBeDispatched;
|
|
||||||
use Flarum\Core\Support\Actor;
|
|
||||||
|
|
||||||
abstract class Action
|
abstract class Action
|
||||||
{
|
{
|
||||||
@@ -20,10 +18,4 @@ abstract class Action
|
|||||||
$action = app($class);
|
$action = app($class);
|
||||||
return $action->call($params);
|
return $action->call($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function dispatch($command, $params = [])
|
|
||||||
{
|
|
||||||
event(new CommandWillBeDispatched($command, $params));
|
|
||||||
return $this->bus->dispatch($command);
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Core\Support;
|
<?php namespace Flarum\Support;
|
||||||
|
|
||||||
use Flarum\Core\Models\Guest;
|
use Flarum\Core\Models\Guest;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
<?php namespace Flarum\Web;
|
<?php namespace Flarum\Support;
|
||||||
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$action = function ($class) {
|
|
||||||
return function () use ($class) {
|
|
||||||
$action = $this->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')
|
|
||||||
]);
|
|
Reference in New Issue
Block a user