mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Add referral codes to user models
This commit is contained in:
parent
f87547a603
commit
aff180deef
@ -12,6 +12,7 @@
|
|||||||
namespace App\Factory;
|
namespace App\Factory;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class UserFactory
|
class UserFactory
|
||||||
{
|
{
|
||||||
@ -29,6 +30,7 @@ class UserFactory
|
|||||||
$user->signature = '';
|
$user->signature = '';
|
||||||
$user->theme_id = 0;
|
$user->theme_id = 0;
|
||||||
$user->user_logged_in_notification = true;
|
$user->user_logged_in_notification = true;
|
||||||
|
$user->referral_code = Str::lower(Str::random(32));
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use App\Models\User;
|
|||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateUser
|
class CreateUser
|
||||||
{
|
{
|
||||||
@ -62,6 +63,7 @@ class CreateUser
|
|||||||
$user->fill($this->request);
|
$user->fill($this->request);
|
||||||
$user->email = $this->request['email']; //todo need to remove this in production
|
$user->email = $this->request['email']; //todo need to remove this in production
|
||||||
$user->last_login = now();
|
$user->last_login = now();
|
||||||
|
$user->referral_code = Str::lower(Str::random(32));
|
||||||
$user->ip = request()->ip();
|
$user->ip = request()->ip();
|
||||||
|
|
||||||
if (Ninja::isSelfHost()) {
|
if (Ninja::isSelfHost()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user