Skip to content

Commit

Permalink
Overall improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyCyborg committed May 17, 2019
1 parent 81e278f commit 94bbdab
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
5 changes: 5 additions & 0 deletions app/Config/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@


return array(
/*
* The routes sorting configuration.
*/
'sortRoutes' => true,

/*
* The Asset Files Serving configuration.
*/
Expand Down
46 changes: 44 additions & 2 deletions app/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,13 +21,27 @@ class BaseController extends Controller
{
use DispatchesJobsTrait, AuthorizesRequestsTrait, ValidatesRequestsTrait;

/**
* The current Request instance.
*
* @var \Nova\Http\Request
*/
protected $request;

/**
* The currently called action.
*
* @var string
*/
protected $action;

/**
* The current call parameters.
*
* @var array
*/
protected $parameters;

/**
* The currently used Theme.
*
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
*
Expand All @@ -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.
*
Expand Down
7 changes: 3 additions & 4 deletions modules/Platform/Controllers/Admin/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')) {
Expand Down
7 changes: 3 additions & 4 deletions modules/Platform/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())) {
Expand Down

0 comments on commit 94bbdab

Please sign in to comment.