Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
lightCMS
提交
3f6146a4
L
lightCMS
项目概览
OpenDocCN
/
lightCMS
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
lightCMS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f6146a4
编写于
10月 16, 2019
作者:
孙
孙建华
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 内容列表接口设置表单请求白名单字段
上级
8b5b7342
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
2 deletion
+10
-2
app/Http/Controllers/Admin/ContentController.php
app/Http/Controllers/Admin/ContentController.php
+4
-2
app/Repository/Admin/EntityFieldRepository.php
app/Repository/Admin/EntityFieldRepository.php
+6
-0
未找到文件。
app/Http/Controllers/Admin/ContentController.php
浏览文件 @
3f6146a4
...
...
@@ -20,7 +20,7 @@ use Illuminate\View\View;
class
ContentController
extends
Controller
{
protected
$formNames
=
[];
protected
$formNames
=
[
'created_at'
,
'updated_at'
];
protected
$entity
=
null
;
...
...
@@ -64,6 +64,7 @@ class ContentController extends Controller
* 内容列表数据接口
*
* @param Request $request
* @param integer $entity
* @return array
*/
public
function
list
(
Request
$request
,
$entity
)
...
...
@@ -74,6 +75,7 @@ class ContentController extends Controller
}
$perPage
=
(
int
)
$request
->
get
(
'limit'
,
50
);
$this
->
formNames
=
array_merge
(
$this
->
formNames
,
EntityFieldRepository
::
getFields
(
$entity
));
$condition
=
$request
->
only
(
$this
->
formNames
);
$data
=
ContentRepository
::
list
(
$entity
,
$perPage
,
$condition
);
...
...
@@ -116,7 +118,7 @@ class ContentController extends Controller
try
{
ContentRepository
::
add
(
$request
->
only
(
EntityFieldRepository
::
get
ByEntityId
(
$entity
)
->
pluck
(
'name'
)
->
toArray
(
)
EntityFieldRepository
::
get
Fields
(
$entity
)
));
return
[
'code'
=>
0
,
...
...
app/Repository/Admin/EntityFieldRepository.php
浏览文件 @
3f6146a4
...
...
@@ -64,4 +64,10 @@ class EntityFieldRepository
return
EntityField
::
query
()
->
where
(
'entity_id'
,
$id
)
->
orderBy
(
'order'
)
->
orderBy
(
'is_show_inline'
)
->
get
();
}
public
static
function
getFields
(
$entityId
)
{
return
EntityField
::
query
()
->
select
(
'name'
)
->
where
(
'entity_id'
,
$entityId
)
->
get
()
->
pluck
(
'name'
)
->
toArray
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录