30 lines
706 B
PHP
30 lines
706 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Resources\SI\SttMedicalHistoryResource;
|
|
use App\Models\SI\SttMedicalHistory;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$pageSize = $request->get('page_size', 15);
|
|
$searchText = $request->get('search', null);
|
|
|
|
$cards = SttMedicalHistory::query();
|
|
|
|
if (!empty($searchText)) {
|
|
$cards = $cards->search($searchText);
|
|
}
|
|
|
|
$cards = SttMedicalHistoryResource::collection($cards->paginate($pageSize));
|
|
|
|
return Inertia::render('Home/Index', [
|
|
'cards' => $cards,
|
|
]);
|
|
}
|
|
}
|