neoban/backend/app/Http/Requests/Chats/GeneratePostRequest.php
kushal-saha cde80dbf08 refactor(core): restructure namespaces for chat-related requests, resources, and responses
- Moved chat-related controllers, resources, requests, and DTOs into their respective `Chats` namespaces.
- Updated route imports to reflect new namespace structure.
2026-04-29 15:39:44 +00:00

32 lines
761 B
PHP

<?php
namespace App\Http\Requests\Chats;
use Illuminate\Foundation\Http\FormRequest;
class GeneratePostRequest extends FormRequest
{
public function rules(): array
{
return [
'prompt' => [
'required',
'string',
'min:3',
function (string $attribute, mixed $value, \Closure $fail): void {
$wordCount = str_word_count(strip_tags(trim($value)));
if ($wordCount > 400) {
$fail("The {$attribute} must not exceed 400 words (you provided {$wordCount} words).");
}
},
],
];
}
public function authorize(): bool
{
return true;
}
}