add status spatial plannings
This commit is contained in:
@@ -26,6 +26,10 @@ class SpatialPlanningController extends Controller
|
||||
$search = $request->input('search', '');
|
||||
|
||||
$query = SpatialPlanning::query();
|
||||
|
||||
// Only include spatial plannings that are not yet issued (is_terbit = false)
|
||||
$query->where('is_terbit', false);
|
||||
|
||||
if ($search) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%$search%")
|
||||
@@ -42,9 +46,11 @@ class SpatialPlanningController extends Controller
|
||||
// Menambhakan nomor urut (No)
|
||||
$start = ($spatialPlannings->currentPage()-1) * $perPage + 1;
|
||||
|
||||
// Tambahkan nomor urut ke dalam data
|
||||
// Tambahkan nomor urut ke dalam data (calculated_retribution sudah auto-append)
|
||||
$data = $spatialPlannings->map(function ($item, $index) use ($start) {
|
||||
return array_merge($item->toArray(), ['no' => $start + $index]);
|
||||
$itemArray = $item->toArray();
|
||||
$itemArray['no'] = $start + $index;
|
||||
return $itemArray;
|
||||
});
|
||||
|
||||
info($data);
|
||||
@@ -104,9 +110,10 @@ class SpatialPlanningController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(SpatialPlanning $spatialPlanning): SpatialPlanning
|
||||
public function show(SpatialPlanning $spatialPlanning): array
|
||||
{
|
||||
return $spatialPlanning;
|
||||
// calculated_retribution and formatted_retribution are already appended via $appends
|
||||
return $spatialPlanning->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user