phpvms/app/Http/Middleware/InstalledCheck.php

35 lines
902 B
PHP
Raw Normal View History

<?php
/**
* Handle the authentication for the API layer
*/
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class InstalledCheck
{
/**
* Check the app.key to see whether we're installed or not
2017-12-17 02:12:26 +08:00
*
* If the default key is set and we're not in any of the installer routes
* show the message that we need to be installed
*
* @param Request $request
* @param Closure $next
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
*/
public function handle(Request $request, Closure $next)
{
if (config('app.key') === 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY='
&& !$request->is(['install', 'install/*'])
&& !$request->is(['update', 'update/*'])
) {
return view('system.errors.not_installed');
}
return $next($request);
}
}