Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
note-library
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
bb31d074
authored
Feb 20, 2023
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
标签
parent
7919aef4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
app/Http/Controllers/ApiController.php
app/Http/routes.php
app/Http/Controllers/ApiController.php
0 → 100644
View file @
bb31d074
<?php
namespace
App\Http\Controllers
;
use
App\Model\TemplateExtendModel
;
Class
ApiController
extends
Controller
{
public
function
getUserLabels
(){
$list
=
\DB
::
connection
(
"label"
)
->
table
(
"template_list"
)
->
where
(
"template_list.status"
,
1
)
->
leftJoin
(
"template_extend"
,
"template_list.id"
,
"="
,
"template_extend.template_id"
)
->
select
(
"template_list.id"
,
"template_list.template_name"
,
"template_extend.html"
,
"template_extend.attribute"
)
->
get
();
$list
=
collect
(
$list
)
->
toArray
();
$arr
=
[];
foreach
(
$list
as
$k
=>
$item
){
$arr
[
$k
][
"template_id"
]
=
$item
->
id
;
$arr
[
$k
][
"template_name"
]
=
$item
->
template_name
;
$arr
[
$k
][
"html"
]
=
$item
->
html
;
$arr
[
$k
][
"attribute"
]
=
$item
->
attribute
;
}
return
[
'code'
=>
0
,
'count'
=>
count
(
$arr
),
'data'
=>
$arr
];
}
}
\ No newline at end of file
app/Http/routes.php
View file @
bb31d074
...
...
@@ -28,6 +28,8 @@ Route::pattern('roleId', '[0-9]+');
|
*/
Route
::
get
(
'/api/get_user_labels'
,
'ApiController@getUserLabels'
);
Route
::
group
([
'middleware'
=>
'web'
],
function
()
{
Route
::
get
(
'/'
,
'WebController@index'
);
...
...
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