Cachet/app/Http/Middleware/AppIsSetup.php

40 lines
900 B
PHP
Raw Normal View History

2014-11-23 21:34:31 +00:00
<?php
/*
* This file is part of Cachet.
*
2015-07-06 17:37:01 +01:00
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
2015-03-20 18:30:45 -06:00
namespace CachetHQ\Cachet\Http\Middleware;
2015-09-19 12:24:53 +01:00
use CachetHQ\Cachet\Facades\Setting;
2015-03-20 18:30:45 -06:00
use Closure;
use Illuminate\Support\Facades\Redirect;
2015-03-20 18:30:45 -06:00
class AppIsSetup
2014-12-20 21:20:17 +00:00
{
2015-01-02 00:54:16 +00:00
/**
2015-09-19 12:25:59 +01:00
* Run the app is setup middleware.
2015-01-02 00:54:16 +00:00
*
2015-09-19 12:25:59 +01:00
* We're verifying that Cachet is correctly setup. If it is, then we're
* redirecting the user to the dashboard so they can use Cachet.
2015-01-02 00:54:16 +00:00
*
2015-12-22 08:41:03 +00:00
* @param \Illuminate\Http\Request $request
* @param \Closure $next
2015-01-02 00:54:16 +00:00
*
2015-03-20 18:30:45 -06:00
* @return mixed
2015-01-02 00:54:16 +00:00
*/
2015-03-20 18:30:45 -06:00
public function handle($request, Closure $next)
2014-12-20 21:20:17 +00:00
{
2015-09-19 12:24:53 +01:00
if (Setting::get('app_name')) {
return Redirect::to('dashboard');
}
2015-03-20 18:30:45 -06:00
return $next($request);
}
}