Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7257dc2e
authored
Nov 18, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增用户添加编码
parent
ba2c5366
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
app/Http/Services/UserService.php
app/Models/UserModel.php
app/Http/Services/UserService.php
0 → 100644
View file @
7257dc2e
<?php
namespace
App\Http\Services
;
use
App\Models\CountryModel
;
use
App\Models\UserModel
;
use
Carbon\Carbon
;
use
Illuminate\Support\Facades\Redis
;
class
UserService
{
public
static
function
generateSn
()
{
$maxInquiryId
=
UserModel
::
orderBy
(
'id'
,
'desc'
)
->
value
(
'id'
);
$id
=
str_pad
((
$maxInquiryId
+
1
),
6
,
0
,
STR_PAD_LEFT
);
$time
=
Carbon
::
now
()
->
addMonths
(
-
9
)
->
addDays
(
-
10
)
->
timestamp
;
return
date
(
'Ymd'
,
$time
)
.
$id
;
}
}
app/Models/UserModel.php
View file @
7257dc2e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Models
;
namespace
App\Models
;
use
App\Http\Services\UserService
;
use
Illuminate\Contracts\Auth\MustVerifyEmail
;
use
Illuminate\Contracts\Auth\MustVerifyEmail
;
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Notifications\Notifiable
;
use
Illuminate\Notifications\Notifiable
;
...
@@ -49,6 +50,7 @@ class UserModel extends Authenticatable implements MustVerifyEmail
...
@@ -49,6 +50,7 @@ class UserModel extends Authenticatable implements MustVerifyEmail
'phone'
=>
$data
[
'phone'
],
'phone'
=>
$data
[
'phone'
],
'email_verified_at'
=>
now
(),
'email_verified_at'
=>
now
(),
'company_name'
=>
$data
[
'company_name'
],
'company_name'
=>
$data
[
'company_name'
],
'user_sn'
=>
UserService
::
generateSn
(),
'account_properties'
=>
$data
[
'account_properties'
],
'account_properties'
=>
$data
[
'account_properties'
],
'password'
=>
Hash
::
make
(
$data
[
'password'
]),
'password'
=>
Hash
::
make
(
$data
[
'password'
]),
]);
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment