Files
Credit-Zombies/app/Rules/PasswordValidationRule.php
2026-06-24 18:29:01 +06:00

55 lines
1.3 KiB
PHP

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class PasswordValidationRule implements Rule
{
protected string $password_validation_rule = '/^(?=[-a-zA-Z0-9!@_*.]*$).*/';
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$inputData = request()->all();
$source_type = '';
if(!empty($inputData['creditreport'])){
$source_type = $inputData['creditreport']['credit_report_company_type'];
}if(!empty($inputData['source_type'])){
$source_type = $inputData['source_type'];
}
if($source_type == config('constant.reportType.SMART_CREDIT'))
{
return preg_match($this->password_validation_rule,$value);
}
elseif ($source_type == config('constant.reportType.IDENTITY_IQ')){
return true;
}
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'Password do not match in provider.';
}
}