forked from magonysandormate/PeePal
Félkész mosdó hozzáadás backend
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?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' => 'required|boolean',
|
||||
'ar' => 'required|numeric',
|
||||
'nyitva' => 'required|string',
|
||||
'utvonal' => 'required|string'
|
||||
]);
|
||||
|
||||
WcAdatok::create([
|
||||
'nev' => $validatedData['nev'],
|
||||
'kerulet' => $validatedData['kerulet'],
|
||||
'kozeli_megall' => $validatedData['kozeli_megall'],
|
||||
'akadalym' => $validatedData['akadalym'],
|
||||
'ar' => $validatedData['ar'],
|
||||
'nyitva' => $validatedData['nyitva'],
|
||||
'nyitva' => $validatedData['nyitva']
|
||||
]);
|
||||
|
||||
return response() -> json([
|
||||
'message' => 'Sikeres rögzítés'
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\HozzaadasController;
|
||||
use App\Http\Controllers\UserController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\WcController;
|
||||
|
||||
|
||||
Route::get('/mosdok', [WcController::class, 'index']);
|
||||
|
||||
Route::get('/mosdok/{id}', [WcController::class, 'show']);
|
||||
|
||||
Route::get('/users', [UserController::class, 'index']);
|
||||
|
||||
Route::post('/hozzaadas', [HozzaadasController::class, 'store']);
|
||||
|
||||
Reference in New Issue
Block a user