'datetime', ]; public function visits() { return visits($this)->relation(); } public function socialAccounts() { return $this->hasMany(SocialAccount::class); } protected static function boot() { parent::boot(); static::creating(function ($user) { if (config('linkstack.disable_random_user_ids') != 'true') { if (is_null(User::first())) { $user->id = 1; } else { $numberOfDigits = config('linkstack.user_id_length') ?? 6; $minIdValue = 10**($numberOfDigits - 1); $maxIdValue = 10**$numberOfDigits - 1; do { $randomId = rand($minIdValue, $maxIdValue); } while (User::find($randomId)); $user->id = $randomId; } } }); } }