feat: Persian panel/API fixes and structural-model tweaks
- lang/fa: add validation/auth/passwords/pagination translations so admin and API validation errors are in Persian - templates: soft-delete instead of cascade-deleting their generations; keep resolving trashed template on generations (labels/downloads) - templates: add TemplateInfolist with a real thumbnail ImageEntry - generations: auto-name template-based generations and use that name for the download file and as a searchable column - admin: show all dates as Jalali via ->jalaliDate()/->jalaliDateTime() Filament macros (App\Support\Jalali) - wallets: harden the deposit/withdraw action to surface the exact error instead of a 500 - profile: normalize Iranian mobile numbers (App\Support\Mobile), add social_links, coerce notification-preference booleans, require the current password to delete an account Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013P66ea1dC5CVM9t29496t5
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests\Profile;
|
||||
|
||||
use App\Support\Mobile;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
@@ -12,6 +13,13 @@ class UpdateProfileRequest extends FormRequest
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
if ($this->has('mobile')) {
|
||||
$this->merge(['mobile' => Mobile::normalize($this->input('mobile'))]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -23,10 +31,16 @@ class UpdateProfileRequest extends FormRequest
|
||||
'name' => ['sometimes', 'required', 'string', 'max:255'],
|
||||
'username' => ['sometimes', 'required', 'string', 'max:255', Rule::unique('users', 'username')->ignore($userId)],
|
||||
'email' => ['sometimes', 'required', 'string', 'email', 'max:255', Rule::unique('users', 'email')->ignore($userId)],
|
||||
'mobile' => ['sometimes', 'required', 'string', 'regex:/^09\d{9}$/', Rule::unique('users', 'mobile')->ignore($userId)],
|
||||
'mobile' => ['sometimes', 'required', 'string', 'regex:'.Mobile::REGEX, Rule::unique('users', 'mobile')->ignore($userId)],
|
||||
'password' => ['sometimes', 'required', 'string', 'min:8'],
|
||||
'avatar' => ['sometimes', 'nullable', 'image', 'max:3072'],
|
||||
'is_public' => ['sometimes', 'nullable', 'boolean'],
|
||||
'social_links' => ['sometimes', 'nullable', 'array'],
|
||||
'social_links.instagram' => ['nullable', 'string', 'max:255'],
|
||||
'social_links.telegram' => ['nullable', 'string', 'max:255'],
|
||||
'social_links.linkedin' => ['nullable', 'string', 'max:255'],
|
||||
'social_links.twitter' => ['nullable', 'string', 'max:255'],
|
||||
'social_links.website' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -43,12 +57,13 @@ class UpdateProfileRequest extends FormRequest
|
||||
'email.email' => 'فرمت ایمیل صحیح نیست.',
|
||||
'email.unique' => 'این ایمیل قبلاً ثبت شده است.',
|
||||
'mobile.required' => 'شماره موبایل الزامی است.',
|
||||
'mobile.regex' => 'فرمت شماره موبایل صحیح نیست.',
|
||||
'mobile.regex' => 'فرمت شماره موبایل صحیح نیست. مثال درست: 09123456789',
|
||||
'mobile.unique' => 'این شماره موبایل قبلاً ثبت شده است.',
|
||||
'password.required' => 'رمز عبور الزامی است.',
|
||||
'password.min' => 'رمز عبور باید حداقل ۸ کاراکتر باشد.',
|
||||
'avatar.image' => 'فایل ارسالی باید تصویر باشد.',
|
||||
'avatar.max' => 'حداکثر حجم تصویر ۳ مگابایت است.',
|
||||
'social_links.array' => 'ساختار شبکههای اجتماعی نامعتبر است.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user