|
@@ -62,7 +62,8 @@ class PostController extends Controller
|
|
'comment_count',
|
|
'comment_count',
|
|
'collect_count',
|
|
'collect_count',
|
|
'create_bean',
|
|
'create_bean',
|
|
- 'is_suggest'
|
|
|
|
|
|
+ 'is_suggest',
|
|
|
|
+ 'is_hide',
|
|
]
|
|
]
|
|
];
|
|
];
|
|
return $data;
|
|
return $data;
|
|
@@ -106,7 +107,7 @@ class PostController extends Controller
|
|
'video' => 'required_if:type,video|string|url',
|
|
'video' => 'required_if:type,video|string|url',
|
|
'topic_ids' => 'required|string|max:64',
|
|
'topic_ids' => 'required|string|max:64',
|
|
'title' => 'nullable|string|max:20',
|
|
'title' => 'nullable|string|max:20',
|
|
- 'content' => 'required|string|max:20',
|
|
|
|
|
|
+ 'content' => 'required|string|max:1000',
|
|
'location' => 'required|string',
|
|
'location' => 'required|string',
|
|
'imgs' => 'required_if:type,image|array|max:9',
|
|
'imgs' => 'required_if:type,image|array|max:9',
|
|
'imgs.*' => 'required|url',
|
|
'imgs.*' => 'required|url',
|
|
@@ -117,6 +118,22 @@ class PostController extends Controller
|
|
return $this->postRepository->create($request->all());
|
|
return $this->postRepository->create($request->all());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 评论&回复
|
|
|
|
+ */
|
|
|
|
+ public function comment(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
|
+ 'post_id' => 'required|integer',
|
|
|
|
+ 'uid' => 'required|integer',
|
|
|
|
+ 'content' => 'required|string|max:150',
|
|
|
|
+ ]);
|
|
|
|
+ if ($validator->fails()) {
|
|
|
|
+ return $this->response->error($validator->errors()->first(), 500);
|
|
|
|
+ }
|
|
|
|
+ return $this->postRepository->comment($request->all());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 推荐内容
|
|
* 推荐内容
|
|
*/
|
|
*/
|
|
@@ -145,6 +162,20 @@ class PostController extends Controller
|
|
return $this->postRepository->delete($request->all());
|
|
return $this->postRepository->delete($request->all());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 删除评论
|
|
|
|
+ */
|
|
|
|
+ public function commentDelete(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
|
+ 'id' => 'required|integer',
|
|
|
|
+ ]);
|
|
|
|
+ if ($validator->fails()) {
|
|
|
|
+ return $this->response->error($validator->errors()->first(), 500);
|
|
|
|
+ }
|
|
|
|
+ return $this->postRepository->commentDelete($request->all());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 隐藏内容
|
|
* 隐藏内容
|
|
*/
|
|
*/
|