Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Observers;
use App\Models\Game\Player\UserCurrency;
use App\Models\User;
class UserObserver
{
public function created(User $user): void
{
$user->settings()->create([
'last_hc_payday' => (setting('give_hc_on_register') ?: '0') == '1' ? now()->addYears(10)->unix() : 0,
]);
if ((setting('give_hc_on_register') ?: '0') == '1') {
$user->hcSubscription()->insert([
'user_id' => $user->id,
'subscription_type' => 'HABBO_CLUB',
'timestamp_start' => now()->unix(),
'duration' => (int) (setting('hc_on_register_duration') ?: 0),
'active' => 1,
]);
}
UserCurrency::upsert([
[
'user_id' => $user->id,
'type' => 0,
'amount' => $user->username === 'Admin' ? 0 : (setting('start_duckets') ?: 0),
],
[
'user_id' => $user->id,
'type' => 5,
'amount' => $user->username === 'Admin' ? 0 : (setting('start_diamonds') ?: 0),
],
[
'user_id' => $user->id,
'type' => 101,
'amount' => $user->username === 'Admin' ? 0 : (setting('start_points') ?: 0),
],
], ['user_id', 'type'], ['amount']);
}
}