41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Investment\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ManualInvestmentRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'user_id' => ['required', 'uuid', 'exists:users,id'],
|
|
'investment_type_id' => ['required', 'uuid', 'exists:investment_types,id'],
|
|
'amount' => ['required', 'numeric', 'gt:0'],
|
|
'remarks' => ['nullable', 'string', 'max:1000'],
|
|
'documents' => ['nullable', 'array'],
|
|
'documents.*' => ['file', 'mimes:pdf,jpg,jpeg,png,doc,docx', 'max:10240'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'user_id.required' => 'Ahli diperlukan.',
|
|
'user_id.exists' => 'Ahli tidak dijumpai.',
|
|
'investment_type_id.required' => 'Jenis pelaburan diperlukan.',
|
|
'investment_type_id.exists' => 'Jenis pelaburan tidak dijumpai.',
|
|
'amount.required' => 'Jumlah pelaburan diperlukan.',
|
|
'amount.gt' => 'Jumlah pelaburan mestilah lebih daripada 0.',
|
|
'documents.*.file' => 'Dokumen mestilah fail yang sah.',
|
|
'documents.*.mimes' => 'Format dokumen tidak disokong. Gunakan PDF, JPG, PNG, DOC atau DOCX.',
|
|
'documents.*.max' => 'Saiz dokumen melebihi had maksimum 10MB.',
|
|
];
|
|
}
|
|
}
|