[H&R] basically

This commit is contained in:
xiaomlove
2021-06-21 02:01:26 +08:00
parent 45aba84111
commit d2a8f1a1a6
39 changed files with 966 additions and 74 deletions

View File

@@ -3,12 +3,15 @@
namespace Nexus\Install;
use App\Models\Attendance;
use App\Models\BonusLogs;
use App\Models\Category;
use App\Models\Exam;
use App\Models\ExamUser;
use App\Models\Icon;
use App\Models\Setting;
use App\Models\User;
use App\Repositories\ExamRepository;
use Carbon\Carbon;
use GuzzleHttp\Client;
use Illuminate\Support\Str;
use Nexus\Database\NexusDB;
@@ -56,6 +59,20 @@ class Update extends Install
return $data;
}
private function addSetting($name, $value)
{
$attributes = [
'name' => $name,
];
$now = Carbon::now()->toDateTimeString();
$values = [
'value' => $value,
'created_at' => $now,
'updated_at' => $now,
];
return Setting::query()->firstOrCreate($attributes, $values);
}
public function runExtraQueries()
{
//custom field menu
@@ -111,6 +128,11 @@ class Update extends Install
if (WITH_LARAVEL && VERSION_NUMBER == '1.6.0-beta9' && NexusDB::schema()->hasColumn('attendance', 'total_days')) {
$this->migrateAttendance();
}
if (WITH_LARAVEL && version_compare(VERSION_NUMBER, '1.6.0-beta12', '>=')) {
$this->addSetting('authority.torrent_hr', User::CLASS_ADMINISTRATOR);
$this->addSetting('bonus.cancel_hr', BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN);
}
}
private function migrateAttendance()