update init category icon_id

This commit is contained in:
xiaomlove
2021-05-29 21:48:50 +08:00
parent 3a54de8be7
commit 8e35dc0886
5 changed files with 35 additions and 11 deletions
+8
View File
@@ -2,6 +2,8 @@
namespace Nexus\Install;
use App\Models\Category;
use App\Models\Icon;
use Nexus\Database\DB;
class Update extends Install
@@ -62,6 +64,12 @@ class Update extends Install
$id = DB::insert($table, $insert);
$this->doLog("[ADD CUSTOM FIELD MENU] insert: " . json_encode($insert) . " to table: $table, id: $id");
}
if (WITH_LARAVEL && DB::schema()->hasColumn('categories', 'icon_id')) {
$icon = Icon::query()->orderBy('id', 'asc')->first();
if ($icon) {
Category::query()->where('icon_id', 0)->update(['icon_id' => $icon->id]);
}
}
}
}
+1 -1
View File
@@ -214,7 +214,7 @@ if ($currentStep == 5) {
</div>
</div>
<div class="m-10 text-center">
欢迎使用 NexusPHP 安装程序,如有疑问,点击<a href="http://nexusphp.org/" target="_blank" class="text-blue-500 p-1">这里</a>获取帮助。
欢迎使用 NexusPHP 安装程序,如有疑问,点击<a href="https://nexusphp.org/" target="_blank" class="text-blue-500 p-1">这里</a>获取帮助。
</div>
</body>
<script>
+8 -2
View File
@@ -3,10 +3,16 @@ ini_set('error_reporting', E_ALL);
ini_set('display_errors', 0);
$rootpath = dirname(dirname(__DIR__)) . '/';
define('ROOT_PATH', $rootpath);
define('IN_NEXUS', true);
$isPost = $_SERVER['REQUEST_METHOD'] == 'POST';
require $rootpath . 'vendor/autoload.php';
require $rootpath . 'nexus/Database/helpers.php';
require $rootpath . 'include/constants.php';
$withLaravel = false;
if (file_exists($rootpath . '.env')) {
require $rootpath . 'include/eloquent.php';
$withLaravel = true;
}
define('WITH_LARAVEL', $withLaravel);
$update = new \Nexus\Install\Update();
$currentStep = $update->currentStep();
@@ -250,7 +256,7 @@ if ($currentStep == 4) {
</div>
</div>
<div class="m-10 text-center">
欢迎使用 NexusPHP 升级程序(v1.5 ~ v1.6),如有疑问,点击<a href="http://nexusphp.org/" target="_blank" class="text-blue-500 p-1">这里</a>获取帮助。
欢迎使用 NexusPHP 升级程序,如有疑问,点击<a href="https://nexusphp.org/" target="_blank" class="text-blue-500 p-1">这里</a>获取帮助。
</div>
</body>
<script>