2014-11-23 21:34:31 +00:00
|
|
|
<?php
|
|
|
|
|
2015-04-19 08:52:39 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Cachet.
|
|
|
|
*
|
2015-07-06 17:37:01 +01:00
|
|
|
* (c) Alt Three Services Limited
|
2015-04-19 08:52:39 +01:00
|
|
|
*
|
|
|
|
* 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-01-02 00:18:19 +00:00
|
|
|
|
2015-09-19 12:24:53 +01:00
|
|
|
use CachetHQ\Cachet\Facades\Setting;
|
2015-03-20 18:30:45 -06:00
|
|
|
use Closure;
|
2015-01-02 00:18:19 +00:00
|
|
|
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');
|
2014-11-27 16:05:00 +00:00
|
|
|
}
|
2015-03-20 18:30:45 -06:00
|
|
|
|
|
|
|
return $next($request);
|
2014-11-27 16:05:00 +00:00
|
|
|
}
|
2014-11-27 22:08:28 +00:00
|
|
|
}
|