* @author James Brooks * @author Joseph Cohen */ class SetupAlreadyCompleted { /** * The settings repository instance. * * @var \CachetHQ\Cachet\Settings\Repository */ protected $settings; /** * Creates a new setup already completed middleware instance. * * @param \CachetHQ\Cachet\Settings\Repository $settings * * @return void */ public function __construct(Repository $settings) { $this->settings = $settings; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle(Request $request, Closure $next) { if ($this->settings->get('app_name')) { return cachet_redirect('dashboard'); } return $next($request); } }