orderBy('id', 'desc'); if($request->has("search") && !empty($request->get("search"))){ $search = $request->get("search"); $query->where('status', 'like', "%".$search."%"); } return ImportDatasourceResource::collection($query->paginate()); } public function checkImportDatasource(){ try{ $data = ImportDatasource::where("status",ImportDatasourceStatus::Processing->value )->count(); $result = [ "can_execute" => $data === 0, "total_processing" => $data ]; return response()->json( $result , 200); }catch(Exception $ex){ return response()->json(["message" => $ex->getMessage(), 500]); } } /** * Store a newly created resource in storage. */ public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }