Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
workbiu-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gxx
workbiu-admin
Commits
b052b96e
Commit
b052b96e
authored
Sep 28, 2017
by
gxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user 模糊查询
parent
65a6c1a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
UserServiceContract.php
app/Contracts/UserServiceContract.php
+1
-1
UserController.php
app/Http/Controllers/UserController.php
+4
-7
UserService.php
app/Services/UserService.php
+19
-0
usertables.blade.php
resources/views/admin/usertables.blade.php
+14
-0
No files found.
app/Contracts/UserServiceContract.php
View file @
b052b96e
...
...
@@ -17,5 +17,5 @@ interface UserServiceContract
public
function
update
(
$id
,
$phone
,
$user_name
,
$real_name
,
$gender
,
$email
,
$head_icon
);
// public function simpleSearch(
);
public
function
simpleSearch
(
$search_content
,
$page
);
}
\ No newline at end of file
app/Http/Controllers/UserController.php
View file @
b052b96e
...
...
@@ -84,16 +84,13 @@ class UserController extends Controller
public
function
simpleSearch
(
Request
$request
)
{
$content
=
$request
->
search
;
$
search_
content
=
$request
->
search
;
$user_name
=
User
::
where
(
'user_name'
,
'like'
,
'%'
.
$content
.
'%'
)
->
get
();
$phone
=
User
::
where
(
'phone'
,
'like'
,
'%'
.
$content
.
'%'
)
->
get
();
$email
=
User
::
where
(
'email'
,
'like'
,
'%'
.
$content
.
'%'
)
->
get
();
$page
=
1
;
$result
=
$this
->
mUser
->
simpleSearch
(
$search_content
,
$page
);
$result
=
[
$user_name
,
$phone
,
$email
];
dd
(
$result
);
return
view
(
'admin/usertables'
,
compact
(
'result'
));
}
}
app/Services/UserService.php
View file @
b052b96e
...
...
@@ -18,6 +18,25 @@ class UserService implements UserServiceContract
{
public
function
simpleSearch
(
$search_content
,
$page
)
{
$user_name
=
User
::
where
(
'user_name'
,
'like'
,
'%'
.
$search_content
.
'%'
)
->
paginate
(
$page
);
$phone
=
User
::
where
(
'phone'
,
'like'
,
'%'
.
$search_content
.
'%'
)
->
paginate
(
$page
);
$email
=
User
::
where
(
'email'
,
'like'
,
'%'
.
$search_content
.
'%'
)
->
paginate
(
$page
);
if
(
count
(
$user_name
)
>
0
){
return
$user_name
;
}
if
(
count
(
$phone
)
>
0
){
return
$phone
;
}
if
(
count
(
$email
)
>
0
){
return
$email
;
}
$result
=
null
;
return
$result
;
}
public
function
getAll
(
$page
)
{
...
...
resources/views/admin/usertables.blade.php
View file @
b052b96e
...
...
@@ -69,6 +69,19 @@
</
tr
>
</
thead
>
@
if
(
$result
==
null
)
<
tbody
>
<
tr
>
<
td
colspan
=
"9"
style
=
"text-align: center;color: red"
>
数据暂无
</
td
>
</
tr
>
</
tbody
>
</
table
>
@
else
@
foreach
(
$result
as
$value
)
...
...
@@ -103,6 +116,7 @@
</
div
>
<!--
/.
row
-->
</
section
>
@
endif
@
endsection
\ No newline at end of file
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