1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Add referral codes to user models

This commit is contained in:
David Bomba 2024-05-27 07:13:56 +10:00
parent f87547a603
commit aff180deef
2 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@
namespace App\Factory;
use App\Models\User;
use Illuminate\Support\Str;
class UserFactory
{
@ -29,6 +30,7 @@ class UserFactory
$user->signature = '';
$user->theme_id = 0;
$user->user_logged_in_notification = true;
$user->referral_code = Str::lower(Str::random(32));
return $user;
}

View File

@ -17,6 +17,7 @@ use App\Models\User;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Str;
class CreateUser
{
@ -62,6 +63,7 @@ class CreateUser
$user->fill($this->request);
$user->email = $this->request['email']; //todo need to remove this in production
$user->last_login = now();
$user->referral_code = Str::lower(Str::random(32));
$user->ip = request()->ip();
if (Ninja::isSelfHost()) {