ابتدا اقدام به نصب پکیج زیر کن با کد دستوری :
composer require Anetwork/Validation
بعد از provider زیر به app اضافه کن :
Anetwork\Validation\PersianValidationServiceProvider::class
بعدش هم توی validation یا همون اعتبار سنجیت از کد های زیر میتونی استفاده کنی
alidator::make( $request->all(), [
'name' => 'persian_alpha|unique|max:25', // Validate Persian alphabet, unique and max to 25 characters
'age' => 'persian_num|required', // Validate Persian numbers and check it's required
'city' => 'persian_alpha_num|min:10', // Validate persian alphabet & numbers at least 10 digit accepted
'mobile' => 'iran_mobile', // Validate mobile number
'sheba_number' => 'sheba', // Validate sheba number of bank account
'melli_code' => 'melli_code', // Validate melli code number
'latin_name' => 'is_not_persian', // Validate alphabet and doesn't contain Persian alphabet or number
'your_array' => 'limited_array:2', // Validate your array variable and must be contian 2 member or lesser
'url' => 'a_url', // Validate url
'domain' => 'a_domain', // Validate domain
'more' => 'more:10', // Validate value be more than parameter
'less' => 'less:10', // Validate value be less than parameter
'phone' => 'iran_phone', // Validate phone number
'card_number' => 'card_number', // Validate payment card number
'address' => 'address' // validate Persian, English and ... alphabet, Persian and English numbers and some special characters
'postal_code' => 'iran_postal_code' // validate iran postal code format
'package_name' => 'package_name' // validate APK package name
]);
نگاه من به شکل زیر از persian_alpha استفاده کردم
$validatedData = $request->validate([
'name' => 'required|min:5|persian_alpha',
'email' => 'required',
'message' => 'required|min:5',
]);
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟