You've already forked Epicnabbo-Catalogus-Updated-Daily
27 lines
650 B
PHP
27 lines
650 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\User;
|
|
|
|
class UserObserver
|
|
{
|
|
public function created(User $user): void
|
|
{
|
|
$isHcEnabled = (setting('give_hc_on_register') ?: '0') === '1';
|
|
|
|
$user->settings()->create([
|
|
'last_hc_payday' => $isHcEnabled ? now()->addYears(10)->unix() : 0,
|
|
]);
|
|
|
|
if ($isHcEnabled) {
|
|
$user->hcSubscription()->insert([
|
|
'user_id' => $user->id,
|
|
'subscription_type' => 'HABBO_CLUB',
|
|
'timestamp_start' => now()->unix(),
|
|
'timestamp_expire' => now()->addYears(10)->unix(),
|
|
]);
|
|
}
|
|
}
|
|
}
|