fork(1) download
  1. protected function validator(array $data)
  2. {
  3. $general = GeneralSetting::first();
  4. $password_validation = Password::min(6);
  5. if ($general->secure_password) {
  6. $password_validation = $password_validation->mixedCase()->numbers()->symbols()->uncompromised();
  7. }
  8. $agree = 'nullable';
  9. if ($general->agree) {
  10. $agree = 'required';
  11. }
  12. $countryData = (array)json_decode(file_get_contents(resource_path('views/partials/country.json')));
  13. $countryCodes = implode(',', array_keys($countryData));
  14. $countries = implode(',', array_column($countryData, 'country'));
  15.  
  16. $validate = Validator::make($data, [
  17. 'firstname' => 'sometimes|required|string|max:50',
  18. 'lastname' => 'sometimes|required|string|max:50',
  19. 'email' => 'required|string|email|max:90|unique:users',
  20. // 'mobile' => 'required|string|max:50|unique:users', // تم إزالته
  21. 'password' => ['required', $password_validation], // تم الإبقاء عليه دون التأكيد
  22. 'username' => 'required|alpha_num|unique:users|min:6',
  23. 'captcha' => 'sometimes|required',
  24. // 'mobile_code' => 'required|in:'.$mobileCodes, // تم إزالته
  25. // 'country_code' => 'required|in:'.$countryCodes, // تم إزالته
  26. 'country' => 'required|in:'.$countries,
  27. 'agree' => $agree
  28. ]);
  29.  
  30. return $validate;
  31. }
  32.  
Success #stdin #stdout 0.02s 25848KB
stdin
H
stdout
protected function validator(array $data)
{
    $general = GeneralSetting::first();
    $password_validation = Password::min(6);
    if ($general->secure_password) {
        $password_validation = $password_validation->mixedCase()->numbers()->symbols()->uncompromised();
    }
    $agree = 'nullable';
    if ($general->agree) {
        $agree = 'required';
    }
    $countryData = (array)json_decode(file_get_contents(resource_path('views/partials/country.json')));
    $countryCodes = implode(',', array_keys($countryData));
    $countries = implode(',', array_column($countryData, 'country'));
    
    $validate = Validator::make($data, [
        'firstname' => 'sometimes|required|string|max:50',
        'lastname' => 'sometimes|required|string|max:50',
        'email' => 'required|string|email|max:90|unique:users',
        // 'mobile' => 'required|string|max:50|unique:users', // تم إزالته
        'password' => ['required', $password_validation], // تم الإبقاء عليه دون التأكيد
        'username' => 'required|alpha_num|unique:users|min:6',
        'captcha' => 'sometimes|required',
        // 'mobile_code' => 'required|in:'.$mobileCodes, // تم إزالته
        // 'country_code' => 'required|in:'.$countryCodes, // تم إزالته
        'country' => 'required|in:'.$countries,
        'agree' => $agree
    ]);
    
    return $validate;
}