<?php

namespace App\Validation;

use Config\Database;
use App\Models\UserModel;

class Myrules
{
	public function valid_password_repeat(string $str = null, string &$error = null): bool
	{
        $db = \Config\Database::connect();
        $request = \Config\Services::request();

        $error = 'Password and repeat password must be same value';

        $data_json = $request->getJSON();

        if(empty($data_json->password) && empty($str))
            return TRUE;

        if(!empty(empty($data_json->password)) && $str == $data_json->password)
        {
            return TRUE;
        }

        return FALSE;
    }
    
}
