2023-11-17 01:44:01 -05:00
|
|
|
<?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;
|
2025-01-12 08:10:52 -05:00
|
|
|
$model = Notice::orderBy('sort', 'ASC')
|
|
|
|
->where('show', true);
|
2023-11-17 01:44:01 -05:00
|
|
|
$total = $model->count();
|
|
|
|
$res = $model->forPage($current, $pageSize)
|
|
|
|
->get();
|
|
|
|
return response([
|
|
|
|
'data' => $res,
|
|
|
|
'total' => $total
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|