Fixes for testing for float

This commit is contained in:
David Bomba 2022-03-23 17:37:39 +11:00
parent bd24a10409
commit f4f0290451
6 changed files with 9 additions and 7 deletions

View File

@ -624,7 +624,7 @@ class BaseController extends Controller
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
// if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) {
if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
$query->where('user_id', '=', auth()->user()->id);
}

View File

@ -156,8 +156,6 @@ class User extends Authenticatable implements MustVerifyEmail
return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();
}
if($truth->getCompany())
return $this->tokens()->where('company_id', $truth->getCompany()->id)->first();
return $this->tokens()->first();
}

View File

@ -212,7 +212,8 @@ trait ClientGroupSettingsSaver
case 'real':
case 'float':
case 'double':
return is_float($value) || is_numeric(strval($value));
return !is_string($value) && (is_float($value) || is_numeric(strval($value)));
//return is_float($value) || is_numeric(strval($value));
case 'string':
return ( is_string( $value ) && method_exists($value, '__toString') ) || is_null($value) || is_string($value);
case 'bool':

View File

@ -59,7 +59,8 @@ trait CompanyGatewayFeesAndLimitsSaver
case 'real':
case 'float':
case 'double':
return is_float($value) || is_numeric(strval($value));
return !is_string($value) && (is_float($value) || is_numeric(strval($value)));
// return is_float($value) || is_numeric(strval($value));
case 'string':
return ( is_string( $value ) && method_exists($value, '__toString') ) || is_null($value) || is_string($value);
case 'bool':

View File

@ -229,7 +229,8 @@ trait CompanySettingsSaver
case 'real':
case 'float':
case 'double':
return is_float($value) || is_numeric(strval($value));
return !is_string($value) && (is_float($value) || is_numeric(strval($value)));
// return is_float($value) || is_numeric(strval($value));
case 'string':
return (is_string($value) && method_exists($value, '__toString')) || is_null($value) || is_string($value);
case 'bool':

View File

@ -92,7 +92,8 @@ trait SettingsSaver
case 'real':
case 'float':
case 'double':
return is_float($value) || is_numeric(strval($value));
return !is_string($value) && (is_float($value) || is_numeric(strval($value)));
// return is_float($value) || is_numeric(strval($value));
case 'string':
return !is_int($value) || ( is_string( $value ) && method_exists($value, '__toString') ) || is_null($value) || is_string($value);
case 'bool':