Chrome:
Request URL:
http://127.0.0.1:8000/admin/posts/51/status
Request Method:
POST
Status Code:
500 Internal Server Error
Remote Address:
127.0.0.1:8000
Referrer Policy:
no-referrer-when-downgrade
post/index.blade.php
@foreach($posts as $post)
<tr>
<td>{{$post->id}}.</td>
<td>{{$post->title}}</td>
<td>
<button type="button" class="btn btn-block btn-default post-audit" post-id="{{$post->id}}" post-action-status="1" >通过</button>
<button type="button" class="btn btn-block btn-default post-audit" post-id="{{$post->id}}" post-action-status="-1" >拒绝</button>
</td>
</tr>
@endforeach
PostController@status
public function status(Post $post)
{
$this->validate(request(), [
"status" => 'required|in:-1,1',
]);
$post->status = request('status');
$post->save();
return [
'error' => 0,
'msg' => ''
];
}
Laravel最新特性结合Mysql异步消息队列、ElasticSearch搜索引擎、Debugbar调试利器开发简书
了解课程