mirror of
https://github.com/v2board/v2board.git
synced 2025-02-11 07:59:11 +08:00
update
This commit is contained in:
parent
91c4bedbad
commit
21050afa60
@ -19,7 +19,8 @@ class NoticeController extends Controller
|
|||||||
public function save (NoticeSave $request) {
|
public function save (NoticeSave $request) {
|
||||||
$data = $request->only([
|
$data = $request->only([
|
||||||
'title',
|
'title',
|
||||||
'content'
|
'content',
|
||||||
|
'img_url'
|
||||||
]);
|
]);
|
||||||
if (!Notice::create($data)) {
|
if (!Notice::create($data)) {
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
@ -32,7 +33,8 @@ class NoticeController extends Controller
|
|||||||
public function update (NoticeSave $request) {
|
public function update (NoticeSave $request) {
|
||||||
$data = $request->only([
|
$data = $request->only([
|
||||||
'title',
|
'title',
|
||||||
'content'
|
'content',
|
||||||
|
'img_url'
|
||||||
]);
|
]);
|
||||||
if (!Notice::where('id', $request->input('id'))->update($data)) {
|
if (!Notice::where('id', $request->input('id'))->update($data)) {
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
|
@ -15,7 +15,8 @@ class NoticeSave extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'required',
|
'title' => 'required',
|
||||||
'content' => 'required'
|
'content' => 'required',
|
||||||
|
'img_url' => 'url'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +24,8 @@ class NoticeSave extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'title.required' => '标题不能为空',
|
'title.required' => '标题不能为空',
|
||||||
'content.required' => '内容不能为空'
|
'content.required' => '内容不能为空',
|
||||||
|
'img_url.url' => '图片URL格式不正确'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user