fixed installed with debug

This commit is contained in:
Edward Yang 2022-09-05 19:29:32 +08:00
parent 0305c28373
commit 64fdcfa712
5 changed files with 25 additions and 9 deletions

View File

@ -28,7 +28,7 @@ class AdminServiceProvider extends ServiceProvider
public function boot()
{
$uri = request()->getRequestUri();
if (Str::startsWith($uri, "/installer")) {
if (is_installer()) {
return;
}

View File

@ -71,6 +71,9 @@ function admin_name(): string
*/
function load_settings()
{
if (is_installer() || !file_exists(__DIR__ . '/../storage/installed')) {
return;
}
$result = \Beike\Repositories\SettingRepo::getGroupedSettings();
config(['bk' => $result]);
}
@ -220,6 +223,18 @@ function is_admin(): bool
return false;
}
/**
* 是否访问安装页面
* @return bool
*/
function is_installer(): bool
{
$uri = request()->getRequestUri();
return Str::startsWith($uri, "/installer");
}
/**
* 是否为当前访问路由
*

View File

@ -16,8 +16,7 @@ class InstallerServiceProvider extends ServiceProvider
{
$this->loadRoutesFrom(__DIR__ . '/../Routes/installer.php');
$uri = request()->getRequestUri();
if (!Str::startsWith($uri, "/installer")) {
if (!is_installer()) {
return;
}

View File

@ -34,7 +34,7 @@ class ShopServiceProvider extends ServiceProvider
public function boot()
{
$uri = request()->getRequestUri();
if (Str::startsWith($uri, "/installer")) {
if (is_installer()) {
return;
}
$this->loadRoutesFrom(__DIR__ . '/../Routes/shop.php');

View File

@ -3,7 +3,9 @@
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
if (!file_exists( __DIR__.'/../storage/installed') && (!isset($_SERVER['REDIRECT_URL']) || substr($_SERVER['REDIRECT_URL'], 0, 10) != '/installer')) {
if (!file_exists(__DIR__ . '/../storage/installed')
&& (!isset($_SERVER['REDIRECT_URL']) || substr($_SERVER['REDIRECT_URL'], 0, 10) != '/installer')
&& (stripos($_SERVER['REQUEST_URI'], '_debugbar') !== 1)) {
header("Location: /installer");
exit;
}
@ -25,8 +27,8 @@ define('LARAVEL_START', microtime(true));
|
*/
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
require __DIR__ . '/../storage/framework/maintenance.php';
}
/*
@ -40,7 +42,7 @@ if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
|
*/
require __DIR__.'/../vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
@ -53,7 +55,7 @@ require __DIR__.'/../vendor/autoload.php';
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);