api surat views increment
This commit is contained in:
parent
802aaea75d
commit
cd8ac64165
|
|
@ -45,8 +45,12 @@ class postsController extends Controller
|
||||||
->where('post_id', $post->getKey());
|
->where('post_id', $post->getKey());
|
||||||
|
|
||||||
if ($obj->count() > 0) {
|
if ($obj->count() > 0) {
|
||||||
$obj = $obj->first();
|
$row = $obj->first();
|
||||||
$post['views'] = $obj->views;
|
|
||||||
|
$views = ++$row->views;
|
||||||
|
|
||||||
|
$obj->update(['views' => $views]);
|
||||||
|
$post['views'] = $row->views;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($post){
|
if ($post){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue