Files
nyone/app/Http/Requests/StoreSupportConversationRequest.php

31 lines
812 B
PHP

<?php
namespace App\Http\Requests;
use App\Models\SupportConversation;
use App\Rules\SupportAttachmentFile;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreSupportConversationRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'category' => ['required', 'string', Rule::in(SupportConversation::categories())],
'subject' => ['required', 'string', 'max:120'],
'body' => ['required', 'string', 'max:2000'],
'attachments' => ['nullable', 'array', 'max:3'],
'attachments.*' => [new SupportAttachmentFile],
];
}
}