feature: first check point

This commit is contained in:
2025-02-24 20:03:36 +07:00
parent a7afbd69fb
commit 6865e353e6
6 changed files with 809 additions and 4 deletions

View File

@@ -21,9 +21,35 @@ class PbgTaskController extends Controller
public function __construct(GoogleSheetService $googleSheetService){
$this->googleSheetService = $googleSheetService;
}
public function index()
public function index(Request $request)
{
//
info($request);
$isLastUpdated = filter_var($request->query('isLastUpdated', false), FILTER_VALIDATE_BOOLEAN);
$query = PbgTask::query();
if ($isLastUpdated) {
$query->orderBy('updated_at', 'desc');
} else {
$query->where('status', 20);
}
// Ambil maksimal 10 data
$pbg_task = $query->limit(10)->get();
$totalData = $pbg_task->count();
// Tambahkan nomor urut
$data = $pbg_task->map(function ($item, $index) {
return array_merge($item->toArray(), ['no' => $index + 1]);
});
return response()->json([
'data' => $data,
'meta' => [
'total' => $totalData
]
]);
}
/**

View File

@@ -106,6 +106,18 @@ class TourismController extends Controller
}
}
public function getAllLocation()
{
$locations = Tourism::whereNotNull('longitude')
->whereNotNull('latitude')
->select('longitude', 'latitude')
->get();
return response()->json([
'data' => $locations
]);
}
/**
* Display the specified resource.
*/