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
97532c3e
authored
Nov 14, 2022
by
LJM
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://git.ichunt.net/semour/semour_admin
parents
e0a4bc3a
d7071222
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
4 deletions
app/Admin/Controllers/UserController.php
app/Admin/Renderable/CreateUser.php
app/Admin/Service/UserService.php
app/Admin/Controllers/UserController.php
View file @
97532c3e
...
...
@@ -2,12 +2,18 @@
namespace
App\Admin\Controllers
;
use
App\Admin\Metrics\Examples\Tickets
;
use
App\Admin\Renderable\CreateUser
;
use
App\Admin\Renderable\UserDetail
;
use
App\Admin\Repositories\User
;
use
App\Admin\Repositories\UserAddress
;
use
App\Admin\Service\UserService
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Http\Controllers\Dashboard
;
use
Dcat\Admin\Layout\Column
;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Layout\Row
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
...
...
@@ -42,8 +48,24 @@ class UserController extends AdminController
*/
protected
function
detail
(
$id
)
{
$address_list
=
(
\App\Admin\Renderable\UserAddress
::
make
([
"key"
=>
$id
])
->
render
());
return
UserDetail
::
make
([
"key"
=>
$id
])
->
render
()
.
$address_list
;
$address_list
=
(
\App\Admin\Renderable\UserAddress
::
make
([
"key"
=>
$id
])
->
render
());
return
UserDetail
::
make
([
"key"
=>
$id
])
->
render
()
.
$address_list
;
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
public
function
create
(
Content
$content
)
{
return
$content
->
header
(
'Dashboard'
)
->
description
(
'Description...'
)
->
body
(
CreateUser
::
make
()
->
render
());
}
/**
...
...
app/Admin/Renderable/CreateUser.php
0 → 100644
View file @
97532c3e
<?php
namespace
App\Admin\Renderable
;
use
App\Admin\Actions\User\UserEditAction
;
use
App\Admin\Repositories\Inquiry
;
use
App\Admin\Repositories\User
;
use
App\Models\InquiryItems
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid\LazyRenderable
;
use
Dcat\Admin\Models\Administrator
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Widgets\Table
;
class
CreateUser
extends
\Dcat\Admin\Support\LazyRenderable
{
public
function
render
()
{
// 只填充内容,不需要标题
return
Form
::
make
(
new
User
(),
function
(
Form
$form
)
{
$form
->
disableDeleteButton
();
$form
->
disableCreatingCheck
();
$form
->
disableViewCheck
();
$form
->
disableEditingCheck
();
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'company_name'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'user_sn'
)
->
required
();
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'first_name'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'last_name'
)
->
required
();
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'phone'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'email'
)
->
required
();
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'reg_source'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'remark'
)
->
required
();
});
})
->
render
();
}
}
app/Admin/Service/UserService.php
View file @
97532c3e
...
...
@@ -36,8 +36,8 @@ class UserService
public
static
function
userListListField
(
Grid
$grid
)
{
$grid
->
column
(
'company_name'
);
$grid
->
column
(
'user_sn'
)
->
link
(
function
(
$user_sn
)
{
return
admin_url
(
'/'
.
$user_sn
);
$grid
->
column
(
'user_sn'
)
->
link
(
function
(
$user_sn
)
use
(
$grid
)
{
return
admin_url
(
"/users/
{
$this
->
id
}
"
);
});
$grid
->
column
(
'name'
);
$grid
->
column
(
'phone'
);
...
...
@@ -50,6 +50,8 @@ class UserService
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'user.options.status'
));
}
public
static
function
userListTool
(
Grid
$grid
)
{
$grid
->
tools
([
...
...
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