@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('otps', function (Blueprint $table) { |
|
16 | + Schema::create('otps', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('user_id')->nullable(); |
19 | 19 | $table->string('identifier'); |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | if ($validity === null) $validity = config('otpify.validity'); |
25 | 25 | |
26 | 26 | Otp::where([ |
27 | - ['identifier', $identifier], |
|
28 | - ['otp_type', $otpType] |
|
27 | + [ 'identifier', $identifier ], |
|
28 | + [ 'otp_type', $otpType ] |
|
29 | 29 | ])->delete(); |
30 | 30 | |
31 | 31 | if (($digits >= 4) && ($digits <= 8)) { |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | public static function validate(string $identifier, string $token, string $otpType = null) |
60 | 60 | { |
61 | 61 | $otp = Otp::where([ |
62 | - ['identifier', $identifier], |
|
63 | - ['otp_type', $otpType] |
|
62 | + [ 'identifier', $identifier ], |
|
63 | + [ 'otp_type', $otpType ] |
|
64 | 64 | ])->first(); |
65 | 65 | |
66 | 66 | if ($otp == null) { |
@@ -20,8 +20,12 @@ |
||
20 | 20 | */ |
21 | 21 | public static function generate(string $identifier, int $userId = null, string $otpType = null, int $digits = null, int $validity = null) |
22 | 22 | { |
23 | - if ($digits === null) $digits = config('otpify.digits'); |
|
24 | - if ($validity === null) $validity = config('otpify.validity'); |
|
23 | + if ($digits === null) { |
|
24 | + $digits = config('otpify.digits'); |
|
25 | + } |
|
26 | + if ($validity === null) { |
|
27 | + $validity = config('otpify.validity'); |
|
28 | + } |
|
25 | 29 | |
26 | 30 | Otp::where([ |
27 | 31 | ['identifier', $identifier], |