mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
26 lines
621 B
PHP
26 lines
621 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\User;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Notice;
|
|
use App\Utils\Helper;
|
|
|
|
class NoticeController extends Controller
|
|
{
|
|
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([
|
|
'data' => $res,
|
|
'total' => $total
|
|
]);
|
|
}
|
|
}
|