diff --git a/app/Config/Routing.php b/app/Config/Routing.php index c734684814..4f6fc2c13b 100644 --- a/app/Config/Routing.php +++ b/app/Config/Routing.php @@ -2,6 +2,11 @@ return array( + /* + * The routes sorting configuration. + */ + 'sortRoutes' => true, + /* * The Asset Files Serving configuration. */ diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 2dea81e91d..761238b249 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -5,6 +5,7 @@ use Nova\Foundation\Auth\Access\AuthorizesRequestsTrait; use Nova\Foundation\Bus\DispatchesJobsTrait; use Nova\Foundation\Validation\ValidatesRequestsTrait; +use Nova\Http\Request; use Nova\Routing\Controller; use Nova\Support\Contracts\RenderableInterface; use Nova\Support\Facades\App; @@ -20,6 +21,13 @@ class BaseController extends Controller { use DispatchesJobsTrait, AuthorizesRequestsTrait, ValidatesRequestsTrait; + /** + * The current Request instance. + * + * @var \Nova\Http\Request + */ + protected $request; + /** * The currently called action. * @@ -27,6 +35,13 @@ class BaseController extends Controller */ protected $action; + /** + * The current call parameters. + * + * @var array + */ + protected $parameters; + /** * The currently used Theme. * @@ -99,13 +114,16 @@ protected function initialize() /** * Execute an action on the controller. * + * @param \Nova\Http\Request $request * @param string $method * @param array $params * @return mixed */ - public function callAction($method, array $parameters) + public function callAction(Request $request, $method, array $parameters) { - $this->action = $method; + $this->request = $request; + $this->action = $method; + $this->parameters = $parameters; // $this->initialize(); @@ -285,6 +303,18 @@ public function autoLayout($enable = null) return $this; } + /** + * Return the current Request instance. + * + * NOTE: this information is available after Controller initialization. + * + * @return \Nova\Http\Request + */ + public function getRequest() + { + return $this->request; + } + /** * Return the current called action * @@ -297,6 +327,18 @@ public function getAction() return $this->action; } + /** + * Return the current call parameters + * + * NOTE: this information is available after Controller initialization. + * + * @return array + */ + public function getParameters() + { + return $this->parameters; + } + /** * Return the current Theme. * diff --git a/modules/Platform/Controllers/Admin/BaseController.php b/modules/Platform/Controllers/Admin/BaseController.php index 3310e1bf4d..1c16ec04c8 100644 --- a/modules/Platform/Controllers/Admin/BaseController.php +++ b/modules/Platform/Controllers/Admin/BaseController.php @@ -5,7 +5,6 @@ use Nova\Auth\Access\AuthorizationException; use Nova\Support\Facades\Auth; use Nova\Support\Facades\Gate; -use Nova\Support\Facades\Request; use Nova\Support\Facades\View; use App\Controllers\BaseController as Controller; @@ -39,9 +38,9 @@ protected function initialize() parent::initialize(); // Update the User Activity. - $request = Request::instance(); - - Activity::updateCurrent($request); + Activity::updateCurrent( + $request = $this->getRequest() + ); // Authorize the current User. if (Gate::denies('platform.backend.manage')) { diff --git a/modules/Platform/Controllers/BaseController.php b/modules/Platform/Controllers/BaseController.php index b24c13c4de..aa3f4f7de7 100644 --- a/modules/Platform/Controllers/BaseController.php +++ b/modules/Platform/Controllers/BaseController.php @@ -3,7 +3,6 @@ namespace Modules\Platform\Controllers; use Nova\Support\Facades\Auth; -use Nova\Support\Facades\Request; use Nova\Support\Facades\View; use App\Controllers\BaseController as Controller; @@ -37,9 +36,9 @@ protected function initialize() parent::initialize(); // Update the User Activity. - $request = Request::instance(); - - Activity::updateCurrent($request); + Activity::updateCurrent( + $request = $this->getRequest() + ); // Update the Frontend Menus. if (! is_null($user = Auth::user())) {