Kész mosdó hozzáadás

This commit is contained in:
Sándor Máté Magony
2025-04-08 11:17:41 +02:00
parent 62b54d4ab4
commit cc7c8bc8dd
12 changed files with 169 additions and 42 deletions

View File

@@ -24,11 +24,11 @@ class HozzaadasController extends Controller
'nev' => 'required|string',
'kerulet' => 'required|string',
'kozeli_megall' => 'required|string',
'akadalym' => 'required|boolean',
'ar' => 'required|numeric',
'nyitva' => 'required|string',
'akadalym' => 'nullable|boolean',
'ar' => 'nullable|numeric',
'nyitva' => 'nullable|string',
'utvonal' => 'required|string',
'koordinatak' => 'nullable|string'
'koordinatak' => 'required|string'
]);
try {

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class Cors
{
public function handle(Request $request, Closure $next)
{
$response = $next($request);
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
$response->headers->set('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
return $response;
}
}

View File

@@ -12,7 +12,15 @@ return Application::configure(basePath: dirname(__DIR__))
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
// Add CORS middleware for API routes
$middleware->api([
\Illuminate\Http\Middleware\HandleCors::class,
]);
// Or if you want to apply CORS to all routes
$middleware->append([
\Illuminate\Http\Middleware\HandleCors::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//

View File

@@ -0,0 +1,12 @@
<?php
return [
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'], // For development; restrict to your frontend URL in production
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@@ -13,11 +13,11 @@ return new class extends Migration
$table->string('nev', 250);
$table->string('kerulet', 250);
$table->string('kozeli_megall', 250);
$table->boolean('akadalym');
$table->integer('ar');
$table->string('nyitva', 250);
$table->double('hossz_koord')->nullable();
$table->double('szel_koord')->nullable();
$table->boolean('akadalym')->nullable();
$table->integer('ar')->nullable();
$table->string('nyitva', 250)->nullable();
$table->double('hossz_koord');
$table->double('szel_koord');
$table->string('utvonal', 1000);
$table->timestamps();
});