fedi-feed-router/app/Http/Requests/StorePlatformAccountRequest.php

36 lines
833 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePlatformAccountRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, string>
*/
public function rules(): array
{
return [
'platform' => 'required|in:lemmy',
'instance_url' => 'required|string|max:255|regex:/^[a-zA-Z0-9]([a-zA-Z0-9\-\.]*[a-zA-Z0-9])?$/',
'username' => 'required|string|max:255',
'password' => 'required|string',
];
}
/**
* @return array<string, string>
*/
public function messages(): array
{
return [
'instance_url.regex' => 'Please enter a valid domain name (e.g., lemmy.world, belgae.social)',
];
}
}