Don't use the config facade and redirect to the route
This commit is contained in:
@@ -16,8 +16,34 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the setup already completed middelware class.
|
||||||
|
*
|
||||||
|
* @author Graham Campbell <james@alt-three.com>
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
* @author Joseph Cohen <joe@alt-three.com>
|
||||||
|
*/
|
||||||
class SetupAlreadyCompleted
|
class SetupAlreadyCompleted
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The config repository instance.
|
||||||
|
*
|
||||||
|
* @var \Illuminate\Contracts\Config\Repository
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new setup already completed middleware instance.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Contracts\Config\Repository $config
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(Repository $config)
|
||||||
|
{
|
||||||
|
$this->config = $config;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
@@ -28,8 +54,8 @@ class SetupAlreadyCompleted
|
|||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if (Config::get('setting.app_name')) {
|
if ($this->config->get('setting.app_name')) {
|
||||||
return Redirect::to('dashboard');
|
return Redirect::route('dashboard.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|||||||
Reference in New Issue
Block a user