框架升级及修复升级后的bug
This commit is contained in:
@@ -124,7 +124,7 @@ class Date
|
||||
*/
|
||||
public static function human($remote, $local = null)
|
||||
{
|
||||
$time_diff = (is_null($local) || $local ? time() : $local) - $remote;
|
||||
$time_diff = (is_null($local) ? time() : $local) - $remote;
|
||||
$tense = $time_diff < 0 ? 'after' : 'ago';
|
||||
$time_diff = abs($time_diff);
|
||||
$chunks = [
|
||||
@@ -146,7 +146,7 @@ class Date
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __("%d $name%s $tense", $count, ($count > 1 ? 's' : ''));
|
||||
return __("%d $name%s $tense", [$count, ($count > 1 ? 's' : '')]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace fast;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
/**
|
||||
* 随机生成类
|
||||
*/
|
||||
@@ -14,7 +16,7 @@ class Random
|
||||
* @param int $len 长度
|
||||
* @return string
|
||||
*/
|
||||
public static function alnum($len = 6)
|
||||
public static function alnum(int $len = 6): string
|
||||
{
|
||||
return self::build('alnum', $len);
|
||||
}
|
||||
@@ -25,7 +27,7 @@ class Random
|
||||
* @param int $len 长度
|
||||
* @return string
|
||||
*/
|
||||
public static function alpha($len = 6)
|
||||
public static function alpha(int $len = 6): string
|
||||
{
|
||||
return self::build('alpha', $len);
|
||||
}
|
||||
@@ -36,7 +38,7 @@ class Random
|
||||
* @param int $len 长度
|
||||
* @return string
|
||||
*/
|
||||
public static function numeric($len = 4)
|
||||
public static function numeric(int $len = 4): string
|
||||
{
|
||||
return self::build('numeric', $len);
|
||||
}
|
||||
@@ -47,7 +49,7 @@ class Random
|
||||
* @param int $len 长度
|
||||
* @return string
|
||||
*/
|
||||
public static function nozero($len = 4)
|
||||
public static function nozero(int $len = 4): string
|
||||
{
|
||||
return self::build('nozero', $len);
|
||||
}
|
||||
@@ -58,7 +60,7 @@ class Random
|
||||
* @param int $len 长度
|
||||
* @return string
|
||||
*/
|
||||
public static function build($type = 'alnum', $len = 8)
|
||||
public static function build(string $type = 'alnum', int $len = 8): string
|
||||
{
|
||||
switch ($type) {
|
||||
case 'alpha':
|
||||
@@ -93,18 +95,8 @@ class Random
|
||||
* 获取全球唯一标识
|
||||
* @return string
|
||||
*/
|
||||
public static function uuid()
|
||||
public static function uuid(): string
|
||||
{
|
||||
return sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0x0fff) | 0x4000,
|
||||
mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff)
|
||||
);
|
||||
return Uuid::uuid4()->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ class Tree
|
||||
'@url' => $childdata || !isset($value['@url']) ? "javascript:;" : $value['@url'],
|
||||
'@addtabs' => $childdata || !isset($value['@url']) ? "" : (stripos($value['@url'], "?") !== false ? "&" : "?") . "ref=addtabs",
|
||||
'@caret' => ($childdata && (!isset($value['@badge']) || !$value['@badge']) ? '<i class="fa fa-angle-left"></i>' : ''),
|
||||
'@badge' => isset($value['@badge']) ? $value['@badge'] : '',
|
||||
'@badge' => $value['@badge'] ?? '',
|
||||
'@class' => ($selected ? ' active' : '') . ($disabled ? ' disabled' : '') . ($childdata ? ' treeview' . (config('fastadmin.show_submenu') ? ' treeview-open' : '') : ''),
|
||||
);
|
||||
$str .= strtr($nstr, $value);
|
||||
@@ -422,7 +422,7 @@ class Tree
|
||||
{
|
||||
$arr = [];
|
||||
foreach ($data as $k => $v) {
|
||||
$childlist = isset($v['childlist']) ? $v['childlist'] : [];
|
||||
$childlist = $v['childlist'] ?? [];
|
||||
unset($v['childlist']);
|
||||
$v[$field] = $v['spacer'] . ' ' . $v[$field];
|
||||
$v['haschild'] = $childlist ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user