map(function ($elem){ return[ "nev"=>$elem->nev, "ar"=>$elem->polo->ar ]; }); return response()->json($adatok,200,["Content-Type"=>"application/json"]); } /** * 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) { $frissit = Vasarlo::find($request["id"]); if(!$frissit){ return response("Sikertelen frissítés",400); } $frissit->update([ "nev"=>$request["nev"], "torzsvasarloSzam"=>$request["torzsvasarloSzam"] ]); return response()->json("Sikeres frissítés",200); } /** * Remove the specified resource from storage. */ public function destroy(string $id) { $torlendo=Vasarlo::find($id); if(!$torlendo){ return response("Sikertelen törlés",404); } $torlendo->delete(); return response("",204); } }