mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-23 11:08:13 -05:00
26 lines
633 B
PHP
26 lines
633 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\V1\User;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Models\Notice;
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
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')
|
||
|
->where('show', 1);
|
||
|
$total = $model->count();
|
||
|
$res = $model->forPage($current, $pageSize)
|
||
|
->get();
|
||
|
return response([
|
||
|
'data' => $res,
|
||
|
'total' => $total
|
||
|
]);
|
||
|
}
|
||
|
}
|