Files
ots/app/Http/Controllers/OTSController.php
T
Twyco d0c606494e
CI/CD / test_and_check_app (push) Failing after 45s
CI/CD / Publish immutable image (push) Skipped
Added OTS create,store,show
2026-10-08 13:51:40 +02:00

34 lines
764 B
PHP

<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreOTSRequest;
use App\Models\OneTimeSecret;
use Illuminate\Http\RedirectResponse;
use Inertia\Inertia;
use Inertia\Response;
class OTSController extends Controller
{
public function store(StoreOTSRequest $request): RedirectResponse
{
$validated = $request->validated();
OneTimeSecret::create(($validated + ['expires_at' => now()->addMinutes(30)]));
return back();
}
public function create(): Response
{
return Inertia::render('ots/Create');
}
public function show(OneTimeSecret $oneTimeSecret): Response
{
$oneTimeSecret->delete();
return Inertia::render('ots/Show', ['oneTimeSecret' => $oneTimeSecret]);
}
}