Page Stubs and Click-Through Flow
This commit is contained in:
19
app/Http/Controllers/LandingController.php
Normal file
19
app/Http/Controllers/LandingController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
final class LandingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the landing page.
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
return Inertia::render('Landing');
|
||||
}
|
||||
}
|
||||
56
app/Http/Controllers/ScreeningController.php
Normal file
56
app/Http/Controllers/ScreeningController.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Screening;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
final class ScreeningController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new screening session for the authenticated user.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$screening = Screening::create([
|
||||
'user_id' => auth()->id(),
|
||||
]);
|
||||
|
||||
return redirect()->route('screening.show', $screening);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the screening questionnaire.
|
||||
*/
|
||||
public function show(Screening $screening): Response
|
||||
{
|
||||
return Inertia::render('Screening/Show', [
|
||||
'screening' => $screening,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save screening answers and redirect to result.
|
||||
*/
|
||||
public function update(Request $request, Screening $screening): RedirectResponse
|
||||
{
|
||||
return redirect()->route('screening.result', $screening);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the screening result with available categories.
|
||||
*/
|
||||
public function result(Screening $screening): Response
|
||||
{
|
||||
return Inertia::render('Screening/Result', [
|
||||
'screening' => $screening,
|
||||
'categories' => Category::orderBy('sort_order')->get(['id', 'name']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
59
app/Http/Controllers/SessionController.php
Normal file
59
app/Http/Controllers/SessionController.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Session;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
final class SessionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new session for the selected category.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$session = Session::create([
|
||||
'user_id' => auth()->id(),
|
||||
'category_id' => $request->input('category_id'),
|
||||
'screening_id' => $request->input('screening_id'),
|
||||
'status' => 'in_progress',
|
||||
]);
|
||||
|
||||
return redirect()->route('sessions.show', $session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the session questionnaire with category.
|
||||
*/
|
||||
public function show(Session $session): Response
|
||||
{
|
||||
$session->load('category');
|
||||
|
||||
return Inertia::render('Session/Show', [
|
||||
'session' => $session,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save session answers and redirect to result.
|
||||
*/
|
||||
public function update(Request $request, Session $session): RedirectResponse
|
||||
{
|
||||
return redirect()->route('sessions.result', $session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the final session result.
|
||||
*/
|
||||
public function result(Session $session): Response
|
||||
{
|
||||
return Inertia::render('Session/Result', [
|
||||
'session' => $session,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user