mirror of
https://github.com/v2board/v2board.git
synced 2024-11-14 07:29:13 +08:00
update
This commit is contained in:
parent
50ffdd9db9
commit
9080de4d0a
@ -11,10 +11,15 @@ class NoticeController extends Controller
|
|||||||
{
|
{
|
||||||
public function fetch(Request $request)
|
public function fetch(Request $request)
|
||||||
{
|
{
|
||||||
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
|
$pageSize = 5;
|
||||||
|
$model = Notice::orderBy('created_at', 'DESC');
|
||||||
|
$total = $model->count();
|
||||||
|
$res = $model->forPage($current, $pageSize)
|
||||||
|
->get();
|
||||||
return response([
|
return response([
|
||||||
'data' => Notice::orderBy('created_at', 'DESC')
|
'data' => $res,
|
||||||
->limit(5)
|
'total' => $total
|
||||||
->get()
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user