Improve support attachment validation errors

This commit is contained in:
2026-05-16 22:19:55 +03:30
parent e633805ed3
commit 95d14f2cec
8 changed files with 153 additions and 19 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Requests;
use App\Models\SupportConversation;
use App\Rules\SupportAttachmentFile;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
@@ -23,7 +24,7 @@ class StoreSupportConversationRequest extends FormRequest
'subject' => ['required', 'string', 'max:120'],
'body' => ['required', 'string', 'max:2000'],
'attachments' => ['nullable', 'array', 'max:3'],
'attachments.*' => ['file', 'max:10240', 'mimes:jpg,jpeg,png,webp,gif,pdf,txt,log,json,zip'],
'attachments.*' => [new SupportAttachmentFile],
];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Requests;
use App\Rules\SupportAttachmentFile;
use Illuminate\Foundation\Http\FormRequest;
class StoreSupportMessageRequest extends FormRequest
@@ -12,14 +13,14 @@ class StoreSupportMessageRequest extends FormRequest
}
/**
* @return array<string, array<int, string>>
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'body' => ['required', 'string', 'max:2000'],
'attachments' => ['nullable', 'array', 'max:3'],
'attachments.*' => ['file', 'max:10240', 'mimes:jpg,jpeg,png,webp,gif,pdf,txt,log,json,zip'],
'attachments.*' => [new SupportAttachmentFile],
];
}
}