feat(portal): lead module, WHMCS sync report/contacts/mapping, service lifecycle email templates
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
3c7710f1de
commit
a443ec3bf6
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lead\App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Modules\Lead\App\Models\Lead;
|
||||
|
||||
class LeadRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'fullname' => ['nullable', 'string', 'max:255'],
|
||||
'company' => ['nullable', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255', Rule::unique('leads', 'email')->ignore($this->route('uuid'), 'uuid')],
|
||||
'phone' => ['nullable', 'string', 'max:30'],
|
||||
'address' => ['nullable', 'string', 'max:1000'],
|
||||
'status' => ['nullable', Rule::in(Lead::STATUSES)],
|
||||
'customer_id' => ['nullable', 'integer', 'exists:customers,id'],
|
||||
'receives_invoice_emails' => ['nullable', 'boolean'],
|
||||
'receives_domain_emails' => ['nullable', 'boolean'],
|
||||
'receives_support_emails' => ['nullable', 'boolean'],
|
||||
'receives_product_emails' => ['nullable', 'boolean'],
|
||||
'receives_general_emails' => ['nullable', 'boolean'],
|
||||
'note' => ['nullable', 'string', 'max:5000'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'email.required' => 'Email là bắt buộc.',
|
||||
'email.unique' => 'Email này đã có trong danh sách khách tiềm năng.',
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
if ($this->has('email')) {
|
||||
$this->merge(['email' => strtolower(trim((string) $this->input('email')))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user