Added OTS create,store,show
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user