public function check($password, $hash)
{
// $2a$ (4) 00 (2) $ (1) <salt> (22)
preg_match('/^\\$2a\\$(\\d{2})\\$(.{22})/D', $hash, $matches);
// Extract the iterations and salt from the hash
$cost = Arr::get($matches, 1);
$salt = Arr::get($matches, 2);
return $this->hash($password, $salt, $cost) === $hash;
}