🆙 Fix errors in db 🆙

This commit is contained in:
Remco
2026-01-18 16:58:07 +01:00
parent 3353fd5e1d
commit 3238cdb8e7
14 changed files with 27 additions and 22 deletions
@@ -0,0 +1,4 @@
EPICWrap V61.2.0
Project: Epicnabbo
Emulator: MORNINGSTAR
By Remco
@@ -18,7 +18,7 @@ return new class extends Migration
$table->string('referral_code')->nullable()->unique()->after('home_room');
});
foreach (User::whereNull('referral_code')->get() as $user) {
foreach (User::query()->whereNull('referral_code')->get() as $user) {
$user->update(['referral_code' => sprintf('%s%s', $user->id, Str::random(8))]);
}
}
@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -98,6 +98,6 @@ class WebsiteArticleFeatureSeeder extends Seeder
],
];
WebsiteShopArticleFeature::insert($features, ['article_id']);
WebsiteShopArticleFeature::query()->insert($features, ['article_id']);
}
}
@@ -11,19 +11,19 @@ class WebsiteArticleSeeder extends Seeder
{
public function run(): void
{
if (User::count() === 0) {
if (User::query()->count() === 0) {
User::factory()->create();
}
$title = 'Atom CMS has been installed';
$slug = Str::slug($title);
WebsiteArticle::firstOrCreate(['slug' => $slug], [
WebsiteArticle::query()->firstOrCreate(['slug' => $slug], [
'slug' => $slug,
'title' => $title,
'short_story' => 'Welcome to your new hotel, we are super happy that you chose to use Atom CMS!',
'full_story' => sprintf('<strong>Welcome to your new hotel</strong>!<br><br>First of all thank you for using Atom CMS - it truly means a lot❤️<br><br>We built Atom CMS for you and your users to get the best possible experience when it comes to visiting %s, and we hope the journey has been a pleasure for you so far.<br><br>We have used modern and industry approved technologies (Laravel & Tailwind CSS) in order to give you the most secure & robust CMS possible.<br><br>Our idea of a good CMS is <strong>accessibility</strong> and just that, is what we have tried to make Atom CMS, so that you can be able to customise it without being a PHP expert or frontend guru. <br/><br/><strong>Some of the built in features</strong><br/>Atom CMS comes packed with tons of features, we will however only mention a few that might help to improve your hotel further!<br/><ul><li>- <a style="color: #42b0f5; text-decoration: underline;" href="https://retros.guide/docs/atom-cms/vpn-block" target="_blank">VPN / IP manager</a> - Allows you to whitelist & blacklist specific IPs or ASNs</li><li>- <a style="color: #42b0f5; text-decoration: underline;" href="https://retros.guide/docs/atom-cms/themes" target="_blank">Theme system</a> - Switch between themes easily or built your own with the simplicity of running a single command!</li><li>- <a style="color: #42b0f5; text-decoration: underline;" href="https://retros.guide/docs/atom-cms/recaptcha" target="_blank">Google ReCaptcha</a> - Keep bots away from your site, by simply enabling Googles recaptcha</li><li>- Built in <a style="color: #42b0f5; text-decoration: underline;" href="https://retros.guide/docs/atom-cms/language" target="_blank">multi language support</a> - Allow your users to browse your site in their preferred language</li></ul><br/><strong>Built in theme system!</strong><br/> Atom CMS has its own theme system, making it an absolute breeze to brew up a new theme or switch themes between the existing ones. If you wish to build your own theme, but is a bit unsure how to start, then head over to the <a style="color: #42b0f5; text-decoration: underline;" href="https://retros.guide/docs/atom-cms/themes" target="__blank">Our documentation site</a>. It gives you a good idea on how to use the theming system and tons of other aspects of running your hotel✨<br><br>With everything being said it is time to wrap up the introduction, but before we do that we want to <strong>wish you the best of luck with your hotel</strong>!', setting('hotel_name')),
'user_id' => User::first()->id,
'user_id' => User::query()->first()->id,
'image' => 'website_news_images/default.png',
]);
}
@@ -77,7 +77,7 @@ class WebsiteHelperCenterCategorySeeder extends Seeder
$attributes[$key] = $value;
}
WebsiteHelpCenterCategory::updateOrCreate(['name' => $category['name']], $attributes);
WebsiteHelpCenterCategory::query()->updateOrCreate(['name' => $category['name']], $attributes);
}
}
}
@@ -13,11 +13,11 @@ class WebsiteMaintenanceTasksSeeder extends Seeder
{
public function run(): void
{
$permission = Permission::orderByDesc('id')->first();
$user = User::where('rank', $permission->id)->first();
$permission = Permission::query()->orderByDesc('id')->first();
$user = User::query()->where('rank', $permission->id)->first();
if ($user === null) {
$user = User::create([
$user = User::query()->create([
'username' => 'Admin',
'mail' => 'admin@example.com',
'password' => Hash::make(Str::password()),
@@ -34,7 +34,7 @@ class WebsiteMaintenanceTasksSeeder extends Seeder
]);
}
WebsiteMaintenanceTask::firstOrCreate(['task' => 'Working on the hotel'], [
WebsiteMaintenanceTask::query()->firstOrCreate(['task' => 'Working on the hotel'], [
'user_id' => $user->id,
'completed' => false,
]);
@@ -53,7 +53,7 @@ class WebsitePermissionSeeder extends Seeder
];
foreach ($permissions as $permission) {
WebsitePermission::firstOrCreate(['permission' => $permission['permission']], [
WebsitePermission::query()->firstOrCreate(['permission' => $permission['permission']], [
'permission' => $permission['permission'],
'min_rank' => $permission['min_rank'],
'description' => $permission['description'],
@@ -32,6 +32,6 @@ class WebsiteRareValuesCategorySeeder extends Seeder
],
];
WebsiteRareValueCategory::upsert($categories, ['name'], ['name', 'badge', 'priority']);
WebsiteRareValueCategory::query()->upsert($categories, ['name'], ['name', 'badge', 'priority']);
}
}
@@ -33,6 +33,6 @@ class WebsiteRuleCategorySeeder extends Seeder
],
];
WebsiteRuleCategory::upsert($categories, ['name']);
WebsiteRuleCategory::query()->upsert($categories, ['name']);
}
}
@@ -195,8 +195,8 @@ class WebsiteRuleSeeder extends Seeder
],
];
if (WebsiteRule::doesntExist()) {
WebsiteRule::insert($rules);
if (WebsiteRule::query()->doesntExist()) {
WebsiteRule::query()->insert($rules);
}
}
}
@@ -288,23 +288,23 @@ class WebsiteSettingsSeeder extends Seeder
];
foreach ($settings as $setting) {
WebsiteSetting::firstOrCreate(['key' => $setting['key']], [
WebsiteSetting::query()->firstOrCreate(['key' => $setting['key']], [
'key' => $setting['key'],
'value' => $setting['value'],
'comment' => $setting['comment'],
]);
}
$recaptchaEnabled = WebsiteSetting::where('key', 'google_recaptcha_enabled')->first();
$recaptchaEnabled = WebsiteSetting::query()->where('key', 'google_recaptcha_enabled')->first();
// This is done to update the rare values key for existing applications
WebsiteSetting::where('key', 'rare_values_icons_path')->update([
WebsiteSetting::query()->where('key', 'rare_values_icons_path')->update([
'key' => 'furniture_icons_path',
]);
// Disables cloudflare turnstile if the seeder is run while having google recaptcha enabled.
if ($recaptchaEnabled->value === '1') {
WebsiteSetting::where('key', 'cloudflare_turnstile_enabled')->update([
WebsiteSetting::query()->where('key', 'cloudflare_turnstile_enabled')->update([
'value' => '0',
]);
}
@@ -10,7 +10,7 @@ class WebsiteShopArticleSeeder extends Seeder
{
public function run(): void
{
$vipCategory = WebsiteShopCategory::where('name', 'VIP')->firstOrCreate(['slug' => 'vip'], [
$vipCategory = WebsiteShopCategory::query()->where('name', 'VIP')->firstOrCreate(['slug' => 'vip'], [
'name' => 'VIP',
'icon_url' => 'https://i.imgur.com/5NBdR0z.gif',
]);
@@ -111,7 +111,7 @@ class WebsiteShopArticleSeeder extends Seeder
];
foreach ($articles as $article) {
WebsiteShopArticle::updateOrCreate(['name' => $article['name']], [
WebsiteShopArticle::query()->updateOrCreate(['name' => $article['name']], [
'website_shop_category_id' => $vipCategory->id,
'name' => $article['name'],
'info' => $article['info'],
@@ -32,6 +32,6 @@ class WebsiteShopCategoriesSeeder extends Seeder
],
];
WebsiteShopCategory::upsert($categories, ['slug'], ['name', 'icon']);
WebsiteShopCategory::query()->upsert($categories, ['slug'], ['name', 'icon']);
}
}