validate([ 'nev' => 'required|string', 'email' => 'required|email|unique:felhasznalok', 'felh_nev' => 'required|string|unique:felhasznalok', 'jelszo' => 'required|string|min:6', 'is_admin' => 'boolean' ]); try { $felhasznalo = User::create([ 'nev' => $validatedData['nev'], 'email' => $validatedData['email'], 'felh_nev' => $validatedData['felh_nev'], 'jelszo' => $validatedData['jelszo'], // Will be hashed by mutator 'is_admin' => $validatedData['is_admin'] ?? false ]); return response()->json([ 'message' => 'Sikeres rögzítés', 'data' => $felhasznalo ], 201); } catch (\Exception $e) { return response()->json([ 'message' => 'Hiba történt a mentés során', 'error' => $e->getMessage() ], 500); } } /** * 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) { // } }