Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
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
25d1b1c3
authored
Dec 06, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
当客户类型为公司时,公司名必填
parent
aff1a7a5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
3 deletions
app/Admin/Controllers/UserController.php
app/Admin/Forms/User/EditUserHandle.php
app/Admin/Renderable/CreateUser.php
resources/lang/en/user.php
resources/lang/zh_CN/user.php
app/Admin/Controllers/UserController.php
View file @
25d1b1c3
...
...
@@ -91,7 +91,7 @@ class UserController extends AdminController
];
$validator
=
Validator
::
make
(
$params
,
[
'company_name'
=>
'required'
,
//
'company_name' => 'required',
'first_name'
=>
'required'
,
'last_name'
=>
'required'
,
'phone'
=>
'required'
,
...
...
@@ -112,6 +112,12 @@ class UserController extends AdminController
$error
=
$validator
->
errors
()
->
first
();
throw
new
\Exception
(
$error
);
}
if
(
$params
[
'account_properties'
]
==
\App\Models\User
::
ACCOUNT_PROPERTIES_ENTERPRISE
)
{
if
(
empty
(
$params
[
'company_name'
]))
{
throw
new
\Exception
(
trans
(
"user.error_msg.requiredByCompanyName"
));
}
}
UserService
::
createUserAndAddress
(
$params
);
}
catch
(
\Throwable
$throwable
)
{
// var_dump((string)$throwable);
...
...
app/Admin/Forms/User/EditUserHandle.php
View file @
25d1b1c3
...
...
@@ -33,6 +33,11 @@ class EditUserHandle extends Form implements LazyRenderable
$input
=
array_filter
(
$input
,
function
(
$value
)
{
return
$value
!==
null
;
});
if
(
$input
[
'account_properties'
]
==
\App\Models\User
::
ACCOUNT_PROPERTIES_ENTERPRISE
)
{
if
(
empty
(
$input
[
'company_name'
]))
{
throw
new
\Exception
(
trans
(
"user.error_msg.requiredByCompanyName"
));
}
}
User
::
updateById
(
$id
,
$input
);
return
$this
...
...
@@ -53,7 +58,7 @@ class EditUserHandle extends Form implements LazyRenderable
$this
->
disableResetButton
();
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
)
->
width
(
4
);
$this
->
row
(
function
(
Row
$form
)
{
$form
->
width
(
5
)
->
text
(
'company_name'
)
->
required
()
;
$form
->
width
(
5
)
->
text
(
'company_name'
);
$form
->
width
(
5
)
->
text
(
'user_sn'
)
->
disable
();
});
$this
->
row
(
function
(
Row
$form
)
{
...
...
app/Admin/Renderable/CreateUser.php
View file @
25d1b1c3
...
...
@@ -26,7 +26,7 @@ class CreateUser extends \Dcat\Admin\Support\LazyRenderable
$form
->
disableResetButton
();
$form
->
disableCreatingCheck
();
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'company_name'
)
->
required
()
;
$form
->
width
(
4
)
->
text
(
'company_name'
);
$form
->
width
(
4
)
->
text
(
'user_sn'
)
->
disable
();
});
$form
->
row
(
function
(
Form\Row
$form
)
{
...
...
resources/lang/en/user.php
View file @
25d1b1c3
...
...
@@ -48,4 +48,7 @@ return [
"2"
=>
"Enterprise"
],
],
"error_msg"
=>
[
"requiredByCompanyName"
=>
"Company name is required when account properties is company"
,
]
];
resources/lang/zh_CN/user.php
View file @
25d1b1c3
...
...
@@ -48,4 +48,7 @@ return [
"2"
=>
"企业"
],
],
"error_msg"
=>
[
"requiredByCompanyName"
=>
"当帐户属性为公司时,需要公司名称必填"
,
]
];
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