@@ -18,15 +18,15 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | $continue = true; |
21 | - while ($continue) { |
|
21 | + while ($continue) { |
|
22 | 22 | |
23 | - $check = $model->where($field, $rnd)->first(); |
|
23 | + $check = $model->where($field, $rnd)->first(); |
|
24 | 24 | |
25 | - if (!$check) |
|
26 | - $continue = false; |
|
25 | + if (!$check) |
|
26 | + $continue = false; |
|
27 | 27 | |
28 | - return $rnd; |
|
29 | - } |
|
28 | + return $rnd; |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | private static function randomStr($length = 16) |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function checkFieldForRandom($model, string $field, string $type = 'str', int $length = 8) |
13 | 13 | { |
14 | - if($type == 'str') { |
|
14 | + if ($type == 'str') { |
|
15 | 15 | $rnd = self::randomStr($length); |
16 | - } else if($type == 'int') { |
|
16 | + } else if ($type == 'int') { |
|
17 | 17 | $rnd = self::randomInt($length); |
18 | 18 | } |
19 | 19 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | |
47 | 47 | private static function randomInt($length = 4) |
48 | 48 | { |
49 | - $rand = ''; |
|
50 | - while( !( isset( $rand[$length-1] ) ) ) { |
|
51 | - $rand .= mt_rand( ); |
|
49 | + $rand = ''; |
|
50 | + while (!(isset($rand[$length - 1]))) { |
|
51 | + $rand .= mt_rand( ); |
|
52 | 52 | } |
53 | - return (int)substr( $rand , 0 , $length ); |
|
53 | + return (int)substr($rand, 0, $length); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -22,8 +22,9 @@ |
||
22 | 22 | |
23 | 23 | $check = $model->where($field, $rnd)->first(); |
24 | 24 | |
25 | - if (!$check) |
|
26 | - $continue = false; |
|
25 | + if (!$check) { |
|
26 | + $continue = false; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | return $rnd; |
29 | 30 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->app->bind(EasyFunction::class, function () { |
|
16 | + $this->app->bind(EasyFunction::class, function() { |
|
17 | 17 | return new EasyFunction(); |
18 | 18 | }); |
19 | 19 | $this->app->alias(EasyFunction::class, 'easy-functions'); |