feature: first check point
This commit is contained in:
@@ -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
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,8 @@ class BigDataController extends Controller
|
||||
return view('dashboards.bigdata', compact('latest_created'));
|
||||
}
|
||||
|
||||
public function pbg(){
|
||||
return view('index');
|
||||
public function pbg()
|
||||
{
|
||||
return view('dashboards.pbg');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user