Skip to main content
Version: v1 (Current)

Phase 6: Portal Integration

Historical design/implementation plan. It is retained as background, not a statement that every proposed feature is available. Use the current component/project guides and the deployed editor before following its recipes.

Overview​

This document details how registration forms and quizzes integrate with the portal system, including authentication flow attachment, form embedding, and attendee creation workflows.

Feature Summary​

  1. Auth Method Attachment: Attach registration forms to portal authentication
  2. Form Page Embedding: Embed forms as portal pages
  3. Post-Registration Flow: Handle attendee creation and login
  4. Access Control: Configure form access requirements
  5. Styling Integration: Form theming with portal styles

1. Portal Authentication Integration​

Attach Registration Form to Auth Method​

Registration forms can be attached to portal authentication methods to create a seamless registration-to-login flow.

Database Schema Addition​

// Add to project_portal_authentication_methods table
Schema::table('project_portal_authentication_methods', function (Blueprint $table) {
// Link to registration form
$table->foreignId('registration_form_id')->nullable()
->constrained('project_forms')->nullOnDelete();

// Registration behavior
$table->enum('registration_mode', [
'disabled', // No registration allowed
'link_only', // Show link to registration page
'inline', // Show registration form inline
'modal', // Show registration in modal
])->default('disabled');

// Post-registration
$table->boolean('auto_login_after_registration')->default(true);
$table->string('registration_success_message')->nullable();
});

ProjectPortalAuthenticationMethod Model Update​

<?php

namespace App\Models;

class ProjectPortalAuthenticationMethod extends Model
{
protected $fillable = [
// ... existing fields
'registration_form_id',
'registration_mode',
'auto_login_after_registration',
'registration_success_message',
];

protected $casts = [
// ... existing casts
'auto_login_after_registration' => 'boolean',
];

public function registrationForm(): BelongsTo
{
return $this->belongsTo(ProjectForm::class, 'registration_form_id');
}

/**
* Check if registration is enabled for this auth method
*/
public function hasRegistration(): bool
{
return $this->registration_mode !== 'disabled' &&
$this->registration_form_id !== null;
}

/**
* Get registration form with settings
*/
public function getRegistrationForm(): ?array
{
if (!$this->hasRegistration()) {
return null;
}

$form = $this->registrationForm;

if (!$form || !$form->isRegistrationForm()) {
return null;
}

return [
'id' => $form->id,
'slug' => $form->slug,
'name' => $form->name,
'mode' => $this->registration_mode,
'settings' => $form->registrationSettings,
];
}
}

Login Controller Integration​

<?php

// app/Http/Controllers/Portal/Auth/LoginController.php

class LoginController extends Controller
{
public function show(Request $request)
{
$portal = $request->attributes->get('portal');
$authMethods = $portal->authenticationMethods()
->where('is_active', true)
->orderBy('priority')
->get();

// Get registration forms for each method
$authMethodsWithRegistration = $authMethods->map(function ($method) {
return [
'id' => $method->id,
'type' => $method->type,
'button_text' => $method->button_text,
'section_title' => $method->section_title,
'config' => $method->config,
'registration' => $method->getRegistrationForm(),
];
});

return Inertia::render('Portal/Pages/Login', [
'authMethods' => $authMethodsWithRegistration,
'portal' => $portal->only(['name', 'theme_colors', 'custom_settings']),
]);
}
}

Frontend Login Page with Registration​

<!-- resources/js/Portal/Pages/Login.vue -->
<script setup>
import { ref, computed } from 'vue'
import { router } from '@inertiajs/vue3'
import PortalLayout from '@/Portal/Layouts/AppLayout.vue'
import PortalLoginForm from '@/Components/PortalLoginForm.vue'
import RegistrationFormInline from '@/Components/Registration/RegistrationFormInline.vue'
import RegistrationModal from '@/Components/Registration/RegistrationModal.vue'
import ModButton from '@/Components/Mod/v2/Elements/ModButton.vue'
import ModTabs from '@/Components/Mod/v2/Navigation/ModTabs.vue'

const props = defineProps({
authMethods: { type: Array, required: true },
portal: { type: Object, required: true },
})

const activeTab = ref('login')
const showRegistrationModal = ref(false)
const selectedRegistrationMethod = ref(null)

// Check if any auth method has registration
const hasAnyRegistration = computed(() =>
props.authMethods.some(m => m.registration)
)

// Get inline registration forms
const inlineRegistrations = computed(() =>
props.authMethods.filter(m => m.registration?.mode === 'inline')
)

// Get link/modal registrations
const linkRegistrations = computed(() =>
props.authMethods.filter(m =>
m.registration?.mode === 'link_only' ||
m.registration?.mode === 'modal'
)
)

const openRegistrationModal = (method) => {
selectedRegistrationMethod.value = method
showRegistrationModal.value = true
}

const handleRegistrationComplete = (result) => {
showRegistrationModal.value = false

if (result.auto_login && result.attendee) {
// Auto-login the new attendee
router.post(route('portal.auth.auto-login'), {
attendee_id: result.attendee.id,
})
} else {
// Show success and switch to login
activeTab.value = 'login'
}
}
</script>

<template>
<PortalLayout>
<div class="login-page">
<div class="login-container">
<h1 class="text-center mb-4">{{ portal.name }}</h1>

<!-- Tabs for Login/Register -->
<ModTabs
v-if="hasAnyRegistration"
v-model="activeTab"
:tabs="[
{ id: 'login', label: 'Sign In' },
{ id: 'register', label: 'Register' },
]"
class="mb-4"
/>

<!-- Login Tab -->
<div v-show="activeTab === 'login'">
<PortalLoginForm :auth-methods="authMethods" />

<!-- Registration Links -->
<div v-if="linkRegistrations.length > 0" class="mt-4 text-center">
<p class="text-muted">Don't have an account?</p>
<div class="d-flex flex-wrap justify-content-center gap-2">
<template v-for="method in linkRegistrations" :key="method.id">
<ModButton
v-if="method.registration.mode === 'link_only'"
color="link"
:href="route('portal.page', { pageSlug: method.registration.slug })"
>
{{ method.registration.name }}
</ModButton>
<ModButton
v-else-if="method.registration.mode === 'modal'"
color="link"
@click="openRegistrationModal(method)"
>
{{ method.registration.name }}
</ModButton>
</template>
</div>
</div>
</div>

<!-- Register Tab -->
<div v-show="activeTab === 'register'">
<!-- Inline Registration Forms -->
<div v-if="inlineRegistrations.length > 0">
<RegistrationFormInline
v-for="method in inlineRegistrations"
:key="method.id"
:form-slug="method.registration.slug"
:auth-method="method"
@complete="handleRegistrationComplete"
class="mb-4"
/>
</div>

<!-- Link to Registration Pages -->
<div v-else-if="linkRegistrations.length > 0" class="text-center">
<p>Select a registration type:</p>
<div class="d-flex flex-column gap-2">
<ModButton
v-for="method in linkRegistrations"
:key="method.id"
color="primary"
outline
@click="
method.registration.mode === 'modal'
? openRegistrationModal(method)
: router.visit(route('portal.page', { pageSlug: method.registration.slug }))
"
>
{{ method.registration.name }}
</ModButton>
</div>
</div>

<p v-else class="text-muted text-center">
Registration is not available at this time.
</p>
</div>
</div>
</div>

<!-- Registration Modal -->
<RegistrationModal
v-if="selectedRegistrationMethod"
v-model="showRegistrationModal"
:form-slug="selectedRegistrationMethod.registration.slug"
:auth-method="selectedRegistrationMethod"
@complete="handleRegistrationComplete"
/>
</PortalLayout>
</template>

2. Form Page Embedding​

Portal Page Types​

Forms can be embedded as portal pages in several ways:

<?php

// app/Models/ProjectPortalPage.php

class ProjectPortalPage extends Model
{
/**
* Get the page content based on model type
*/
public function getContent(): array
{
return match ($this->model_type) {
ProjectForm::class => $this->getFormContent(),
ProjectPage::class => $this->getPageContent(),
default => [],
};
}

protected function getFormContent(): array
{
$form = $this->model;

if (!$form) {
return ['error' => 'Form not found'];
}

return [
'type' => 'form',
'form_type' => $form->form_type,
'form' => $form->load(['sections.fields', 'registrationSettings', 'quizSettings']),
'schema' => $this->getFormSchema($form),
];
}

protected function getFormSchema(ProjectForm $form): array
{
if ($form->schema_version === 'v2') {
return [
'root' => $form->root_config,
'cards' => $form->cards_config,
'elements' => $form->elements_config,
];
}

// Translate v1 to v2
$translator = app(FormSchemaTranslatorService::class);
return $translator->translateV1ToV2($form);
}
}

Page Controller Form Handling​

<?php

// app/Http/Controllers/Portal/PageController.php

class PageController extends Controller
{
public function show(Request $request, string $pageSlug)
{
$portal = $request->attributes->get('portal');
$portalPage = $portal->portalPages()
->where('url_slug', $pageSlug)
->firstOrFail();

// Check authentication requirement
if ($portalPage->requires_authentication) {
$this->authService->authenticate($request);
}

$content = $portalPage->getContent();

// Route to appropriate handler based on content type
return match ($content['type'] ?? 'page') {
'form' => $this->renderForm($request, $portal, $portalPage, $content),
default => $this->renderPage($request, $portal, $portalPage, $content),
};
}

protected function renderForm(
Request $request,
ProjectPortal $portal,
ProjectPortalPage $portalPage,
array $content
) {
$form = $content['form'];
$attendee = $request->attributes->get('attendee');

// Handle different form types
return match ($form->form_type) {
'registration' => $this->renderRegistrationForm($request, $portal, $portalPage, $form, $attendee),
'quiz' => $this->renderQuizForm($request, $portal, $portalPage, $form, $attendee),
default => $this->renderStandardForm($request, $portal, $portalPage, $form, $attendee),
};
}

protected function renderRegistrationForm(
Request $request,
ProjectPortal $portal,
ProjectPortalPage $portalPage,
ProjectForm $form,
?Attendee $attendee
) {
$resumeSession = null;

// Check for resume token
if ($token = $request->query('resume')) {
$resumeSession = app(FormResumeService::class)->findByToken($token);
}

// Get allowed attendee types
$attendeeTypes = $form->getAllowedAttendeeTypes();

return Inertia::render('Portal/Pages/RegistrationForm', [
'portal' => $this->formatPortalData($portal),
'portalPage' => $portalPage,
'form' => $form,
'schema' => $this->getFormSchema($form),
'settings' => $form->registrationSettings,
'attendeeTypes' => $attendeeTypes,
'resumeSession' => $resumeSession ? [
'token' => $resumeSession->session_token,
'formData' => $resumeSession->form_data,
'lastSectionId' => $resumeSession->last_section_id,
'completionPercentage' => $resumeSession->completion_percentage,
] : null,
'existingAttendee' => $attendee,
]);
}

protected function renderQuizForm(
Request $request,
ProjectPortal $portal,
ProjectPortalPage $portalPage,
ProjectForm $form,
?Attendee $attendee
) {
if (!$attendee) {
// Quiz requires authentication
return redirect()->route('portal.login', [
'redirect' => $request->url(),
]);
}

$quizService = app(QuizService::class);
$quizState = $quizService->getQuizState($form, $attendee);

return Inertia::render('Portal/Pages/QuizForm', [
'portal' => $this->formatPortalData($portal),
'portalPage' => $portalPage,
'form' => $form,
'schema' => $this->getFormSchema($form),
'settings' => $form->quizSettings,
'quizState' => $quizState,
'attendee' => $attendee->only(['id', 'first_name', 'last_name']),
]);
}

protected function renderStandardForm(
Request $request,
ProjectPortal $portal,
ProjectPortalPage $portalPage,
ProjectForm $form,
?Attendee $attendee
) {
return Inertia::render('Portal/Pages/Form', [
'portal' => $this->formatPortalData($portal),
'portalPage' => $portalPage,
'form' => $form,
'schema' => $this->getFormSchema($form),
'attendee' => $attendee,
]);
}
}

3. Post-Registration Authentication Flow​

Auto-Login After Registration​

<?php

// app/Http/Controllers/Portal/Auth/RegistrationAuthController.php

namespace App\Http\Controllers\Portal\Auth;

use App\Models\Attendee;
use App\Services\Portal\AttendeeAuthService;
use Illuminate\Http\Request;

class RegistrationAuthController extends Controller
{
public function __construct(
protected AttendeeAuthService $authService,
) {}

/**
* Auto-login attendee after registration
*/
public function autoLogin(Request $request)
{
$request->validate([
'attendee_id' => 'required|integer',
'registration_token' => 'required|string',
]);

// Verify the registration token (prevents unauthorized login)
$token = $request->input('registration_token');
$attendeeId = $request->input('attendee_id');

if (!$this->verifyRegistrationToken($token, $attendeeId)) {
return back()->withErrors([
'auth' => 'Invalid registration token.',
]);
}

$attendee = Attendee::findOrFail($attendeeId);
$portal = $request->attributes->get('portal');

// Log in the attendee
$this->authService->login($attendee, $portal);

// Redirect to post-login page
$redirectPath = $this->getPostLoginRedirect($portal, $attendee);

return redirect($redirectPath);
}

/**
* Verify registration token
*/
protected function verifyRegistrationToken(string $token, int $attendeeId): bool
{
$expected = hash_hmac(
'sha256',
"registration:{$attendeeId}",
config('app.key')
);

return hash_equals($expected, $token);
}

/**
* Generate registration token for auto-login
*/
public static function generateRegistrationToken(int $attendeeId): string
{
return hash_hmac(
'sha256',
"registration:{$attendeeId}",
config('app.key')
);
}

/**
* Get post-login redirect path
*/
protected function getPostLoginRedirect(ProjectPortal $portal, Attendee $attendee): string
{
// Check for stored redirect
$intended = session('portal.intended_url');
if ($intended) {
session()->forget('portal.intended_url');
return $intended;
}

// Check portal default redirect
if ($portal->custom_settings['post_login_redirect'] ?? null) {
return $portal->custom_settings['post_login_redirect'];
}

// Default to portal home
return route('portal.index');
}
}

Registration Form Controller Update​

<?php

// app/Http/Controllers/Portal/RegistrationFormController.php

class RegistrationFormController extends Controller
{
public function submit(Request $request, string $formSlug)
{
$form = ProjectForm::where('slug', $formSlug)->firstOrFail();

$result = $this->registrationService->submit(
$form,
$request->all(),
$this->getResumeSession($request),
$request->ip(),
$request->userAgent()
);

if ($result['success']) {
$response = [
'success' => true,
'message' => $this->getSuccessMessage($form, $result),
];

// Include auto-login token if applicable
$settings = $form->registrationSettings;
$authMethod = $this->findAuthMethod($form);

if ($authMethod?->auto_login_after_registration && $result['action'] === 'created') {
$response['auto_login'] = true;
$response['attendee'] = $result['attendee']->only(['id', 'first_name', 'last_name']);
$response['registration_token'] = RegistrationAuthController::generateRegistrationToken(
$result['attendee']->id
);
}

return response()->json($response);
}

return response()->json($result, $result['duplicate'] ? 409 : 400);
}

protected function findAuthMethod(ProjectForm $form): ?ProjectPortalAuthenticationMethod
{
return ProjectPortalAuthenticationMethod::where('registration_form_id', $form->id)
->where('is_active', true)
->first();
}

protected function getSuccessMessage(ProjectForm $form, array $result): string
{
$authMethod = $this->findAuthMethod($form);

if ($authMethod?->registration_success_message) {
return $authMethod->registration_success_message;
}

return match ($result['action']) {
'created' => 'Registration successful! Welcome!',
'updated' => 'Your information has been updated.',
'existing' => 'You are already registered.',
default => 'Thank you for your submission.',
};
}
}

4. Portal Page Access Control​

Form Access Requirements​

<?php

// app/Services/Portal/FormAccessService.php

namespace App\Services\Portal;

use App\Models\ProjectForm;
use App\Models\ProjectPortalPage;
use App\Models\Attendee;
use App\Models\ProjectPortal;

class FormAccessService
{
/**
* Check if attendee can access form
*/
public function canAccess(
ProjectForm $form,
ProjectPortalPage $portalPage,
?Attendee $attendee,
ProjectPortal $portal
): array {
// Check if form is active
if (!$form->is_active) {
return [
'allowed' => false,
'reason' => 'form_inactive',
'message' => 'This form is not currently available.',
];
}

// Check time-based access
if ($form->open_form_at && now()->lt($form->open_form_at)) {
return [
'allowed' => false,
'reason' => 'not_open',
'message' => 'This form is not yet open.',
'opens_at' => $form->open_form_at,
];
}

if ($form->close_form_at && now()->gt($form->close_form_at)) {
return [
'allowed' => false,
'reason' => 'closed',
'message' => 'This form has closed.',
'closed_at' => $form->close_form_at,
];
}

// Check authentication requirement
if ($portalPage->requires_authentication && !$attendee) {
return [
'allowed' => false,
'reason' => 'auth_required',
'message' => 'Please log in to access this form.',
'redirect' => route('portal.login'),
];
}

// Check group access
if ($portalPage->permission_flags) {
$requiredGroups = $portalPage->permission_flags['required_groups'] ?? [];

if (!empty($requiredGroups) && $attendee) {
$attendeeGroups = $attendee->groups->pluck('id')->toArray();
$hasAccess = !empty(array_intersect($requiredGroups, $attendeeGroups));

if (!$hasAccess) {
return [
'allowed' => false,
'reason' => 'group_required',
'message' => 'You do not have access to this form.',
];
}
}
}

// Form-specific checks
if ($form->form_type === 'quiz' && $attendee) {
$quizSettings = $form->quizSettings;

if ($quizSettings && !$quizSettings->canAttempt($attendee)) {
return [
'allowed' => false,
'reason' => 'max_attempts',
'message' => 'You have reached the maximum number of attempts.',
];
}
}

return [
'allowed' => true,
];
}
}

Middleware for Form Access​

<?php

// app/Http/Middleware/CheckFormAccess.php

namespace App\Http\Middleware;

use App\Services\Portal\FormAccessService;
use Closure;
use Illuminate\Http\Request;

class CheckFormAccess
{
public function __construct(
protected FormAccessService $accessService,
) {}

public function handle(Request $request, Closure $next)
{
$portalPage = $request->attributes->get('portalPage');

if (!$portalPage || $portalPage->model_type !== ProjectForm::class) {
return $next($request);
}

$form = $portalPage->model;
$portal = $request->attributes->get('portal');
$attendee = $request->attributes->get('attendee');

$access = $this->accessService->canAccess($form, $portalPage, $attendee, $portal);

if (!$access['allowed']) {
if ($access['reason'] === 'auth_required') {
session(['portal.intended_url' => $request->url()]);
return redirect($access['redirect']);
}

return Inertia::render('Portal/Pages/FormAccessDenied', [
'reason' => $access['reason'],
'message' => $access['message'],
'metadata' => $access,
]);
}

return $next($request);
}
}

5. Form Styling Integration​

Portal Theme Application​

<?php

// app/Services/Portal/FormStyleService.php

namespace App\Services\Portal;

use App\Models\ProjectForm;
use App\Models\ProjectPortal;

class FormStyleService
{
/**
* Get merged styles for form
*/
public function getFormStyles(ProjectForm $form, ProjectPortal $portal): array
{
// Start with portal theme
$styles = [
'colors' => $portal->theme_colors ?? [],
'fonts' => $portal->custom_settings['fonts'] ?? [],
];

// Merge form-specific style overrides
if ($form->style_overrides) {
$styles = array_merge_recursive($styles, $form->style_overrides);
}

return $styles;
}

/**
* Generate CSS variables for form
*/
public function generateCssVariables(array $styles): string
{
$css = ':root {';

// Color variables
foreach ($styles['colors'] ?? [] as $name => $value) {
$css .= "--form-color-{$name}: {$value};";
}

// Font variables
foreach ($styles['fonts'] ?? [] as $name => $value) {
$css .= "--form-font-{$name}: {$value};";
}

$css .= '}';

return $css;
}
}

Frontend Style Integration​

<!-- resources/js/Components/Portal/PortalFormWrapper.vue -->
<script setup>
import { computed, onMounted } from 'vue'

const props = defineProps({
form: { type: Object, required: true },
portal: { type: Object, required: true },
styles: { type: Object, default: () => ({}) },
})

// Generate inline styles from theme
const formStyles = computed(() => {
const colors = props.styles.colors || props.portal.theme_colors || {}

return {
'--form-primary': colors.primary || '#007bff',
'--form-secondary': colors.secondary || '#6c757d',
'--form-success': colors.success || '#28a745',
'--form-danger': colors.danger || '#dc3545',
'--form-background': colors.background || '#ffffff',
'--form-text': colors.text || '#212529',
'--form-border': colors.border || '#dee2e6',
'--form-border-radius': colors.borderRadius || '0.375rem',
}
})

onMounted(() => {
// Apply CSS variables to document root
const root = document.documentElement
Object.entries(formStyles.value).forEach(([key, value]) => {
root.style.setProperty(key, value)
})
})
</script>

<template>
<div class="portal-form-wrapper" :style="formStyles">
<slot />
</div>
</template>

<style>
.portal-form-wrapper {
--primary: var(--form-primary);
--secondary: var(--form-secondary);
}

.portal-form-wrapper .btn-primary {
background-color: var(--form-primary);
border-color: var(--form-primary);
}

.portal-form-wrapper .form-control:focus {
border-color: var(--form-primary);
box-shadow: 0 0 0 0.2rem rgba(var(--form-primary-rgb), 0.25);
}
</style>

6. Admin Portal Page Configuration​

ShowPage Tab for Portal Form Settings​

// Portal Page Show configuration for form pages

const formPageSettingsCard = {
type: 'fields_list',
title: 'Form Page Settings',
icon: 'file-alt',
condition: {
field: 'model_type',
operator: '==',
value: 'App\\Models\\ProjectForm',
},
fieldsList: [
{
type: 'boolean',
style: 'switch',
name: 'requires_authentication',
label: 'Require Authentication',
description: 'Users must be logged in to access this form',
colsMd: 6,
},
{
type: 'boolean',
style: 'switch',
name: 'access_code_enabled',
label: 'Require Access Code',
description: 'Page-level access code requirement',
colsMd: 6,
},
{
type: 'async-select',
style: 'multi-select',
name: 'permission_flags.required_groups',
label: 'Required Groups',
description: 'Only members of these groups can access',
asyncRoute: 'api.groups.search',
colsMd: 12,
},
{
type: 'input',
style: 'text',
name: 'custom_settings.success_redirect',
label: 'Success Redirect URL',
description: 'Redirect here after form submission (optional)',
placeholder: '/thank-you',
colsMd: 6,
},
{
type: 'input',
style: 'text',
name: 'custom_settings.cancel_redirect',
label: 'Cancel Redirect URL',
description: 'Redirect here if user cancels (optional)',
placeholder: '/',
colsMd: 6,
},
],
}

API Endpoints​

Portal Form Routes​

// routes/portal/app.php

Route::middleware(['portal.config', 'portal.form.access'])->group(function () {
// Form pages
Route::get('/{pageSlug}', [PageController::class, 'show'])
->name('portal.page');

// Registration form endpoints
Route::prefix('forms/{form}')->group(function () {
Route::post('submit', [RegistrationFormController::class, 'submit']);
Route::post('save-progress', [RegistrationFormController::class, 'saveProgress']);
Route::post('request-resume-link', [RegistrationFormController::class, 'requestResumeLink']);
});

// Quiz endpoints
Route::prefix('quiz/{form}')->group(function () {
Route::get('state', [QuizController::class, 'state']);
Route::post('start', [QuizController::class, 'start']);
Route::post('attempts/{attempt}/answer', [QuizController::class, 'answer']);
Route::post('attempts/{attempt}/complete', [QuizController::class, 'complete']);
});

// Auth endpoints
Route::post('auth/auto-login', [RegistrationAuthController::class, 'autoLogin']);
});

Route::get('forms/resume/{token}', [RegistrationFormController::class, 'resume'])
->name('portal.form.resume');

Admin Portal Page Routes​

// routes/admin/dashboard.php

Route::prefix('portals/{portal}/pages')->group(function () {
Route::get('/', [PortalPageController::class, 'index']);
Route::post('/', [PortalPageController::class, 'store']);
Route::get('{page}', [PortalPageController::class, 'show']);
Route::put('{page}', [PortalPageController::class, 'update']);
Route::delete('{page}', [PortalPageController::class, 'destroy']);
Route::post('reorder', [PortalPageController::class, 'reorder']);

// Form page specific
Route::post('{page}/attach-form', [PortalPageController::class, 'attachForm']);
Route::delete('{page}/detach-form', [PortalPageController::class, 'detachForm']);
});

Route::prefix('portals/{portal}/auth-methods')->group(function () {
Route::put('{method}/registration', [PortalAuthMethodController::class, 'updateRegistration']);
});

Next Steps​