forked from magonysandormate/PeePal
Kész(?)
This commit is contained in:
@@ -35,7 +35,7 @@ class AuthController extends Controller
|
||||
'nev' => $request->nev,
|
||||
'email' => $request->email,
|
||||
'felh_nev' => $request->felh_nev,
|
||||
'jelszo' => $request->jelszo, // This will be hashed via the mutator
|
||||
'jelszo' => $request->jelszo,
|
||||
'is_admin' => $request->is_admin ?? false
|
||||
]);
|
||||
|
||||
@@ -56,10 +56,9 @@ class AuthController extends Controller
|
||||
return response()->json($validator->errors(), 422);
|
||||
}
|
||||
|
||||
// Since your login fields are custom, you need to specify the fields
|
||||
$credentials = [
|
||||
'felh_nev' => $request->felh_nev,
|
||||
'password' => $request->jelszo // Laravel expects 'password' internally
|
||||
'password' => $request->jelszo
|
||||
];
|
||||
|
||||
if (!$token = auth('api')->attempt($credentials)) {
|
||||
@@ -96,7 +95,7 @@ class AuthController extends Controller
|
||||
return response()->json([
|
||||
'access_token' => $token,
|
||||
'token_type' => 'bearer',
|
||||
'expires_in' => config('jwt.ttl') * 60, // Getting TTL from config
|
||||
'expires_in' => config('jwt.ttl') * 60,
|
||||
'user' => auth('api')->user()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\WcAdatok;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HozzaadasController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validatedData = $request -> validate([
|
||||
'nev' => 'required|string',
|
||||
'kerulet' => 'required|string',
|
||||
'kozeli_megall' => 'required|string',
|
||||
'akadalym' => 'nullable|boolean',
|
||||
'ar' => 'nullable|numeric',
|
||||
'nyitva' => 'nullable|string',
|
||||
'utvonal' => 'required|string',
|
||||
'koordinatak' => 'required|string'
|
||||
]);
|
||||
|
||||
try {
|
||||
$szelesseg = null;
|
||||
$hosszusag = null;
|
||||
|
||||
if (!empty($validatedData['koordinatak'])) {
|
||||
$koordinatak = explode(',', $validatedData['koordinatak']);
|
||||
|
||||
if (count($koordinatak) == 2) {
|
||||
$hosszusag = trim($koordinatak[0]);
|
||||
$szelesseg = trim($koordinatak[1]);
|
||||
|
||||
if (!is_numeric($szelesseg) || !is_numeric($hosszusag)) {
|
||||
return response() -> json([
|
||||
'message' => 'Érvénytelen a koordináták formátuma'
|
||||
], 422);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mosdo = WcAdatok::create([
|
||||
'nev' => $validatedData['nev'],
|
||||
'kerulet' => $validatedData['kerulet'],
|
||||
'kozeli_megall' => $validatedData['kozeli_megall'],
|
||||
'akadalym' => $validatedData['akadalym'],
|
||||
'ar' => $validatedData['ar'],
|
||||
'nyitva' => $validatedData['nyitva'],
|
||||
'utvonal' => $validatedData['utvonal'],
|
||||
'szel_koord' => $szelesseg,
|
||||
'hossz_koord' => $hosszusag
|
||||
]);
|
||||
|
||||
return response() -> json([
|
||||
'message' => 'Sikeres rögzítés',
|
||||
'data' => $mosdo
|
||||
], 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -8,17 +8,6 @@ use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
@@ -34,7 +23,7 @@ class UserController extends Controller
|
||||
'nev' => $validatedData['nev'],
|
||||
'email' => $validatedData['email'],
|
||||
'felh_nev' => $validatedData['felh_nev'],
|
||||
'jelszo' => $validatedData['jelszo'], // Will be hashed by mutator
|
||||
'jelszo' => $validatedData['jelszo'],
|
||||
'is_admin' => $validatedData['is_admin'] ?? false
|
||||
]);
|
||||
|
||||
@@ -49,28 +38,4 @@ class UserController extends Controller
|
||||
], 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,4 @@ class WcController extends Controller
|
||||
return response()->json(['message' => 'Nem található'], 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user