Fix Master Province

This commit is contained in:
Daeng Deni Mardaeni
2024-08-09 15:02:27 +07:00
parent aa3289bd56
commit 5f95adddd5
3 changed files with 6 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ class ProvincesExport implements WithColumnFormatting, WithHeadings, FromCollect
public function columnFormats(): array{
return [
'A' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER,
'C' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME
'D' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME
];
}
}

View File

@@ -79,7 +79,8 @@ class ProvincesController extends Controller
if ($request->has('search') && !empty($request->get('search'))) {
$search = $request->get('search');
$query->where(function ($q) use ($search) {
$q->where('name', 'LIKE', "%$search%");
$q->where('code', 'LIKE', "%$search%");
$q->orWhere('name', 'LIKE', "%$search%");
});
}
@@ -106,7 +107,7 @@ class ProvincesController extends Controller
$filteredRecords = $query->count();
// Get the data for the current page
$roles = $query->get();
$provinces = $query->get();
// Calculate the page count
$pageCount = ceil($totalRecords/$request->get('size'));
@@ -122,7 +123,7 @@ class ProvincesController extends Controller
'pageCount' => $pageCount,
'page' => $currentPage,
'totalCount' => $totalRecords,
'data' => $roles,
'data' => $provinces,
]);
}