-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703bae9
commit 3362afc
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use Laravel\Fortify\Fortify; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->text('two_factor_secret') | ||
->after('password') | ||
->nullable(); | ||
|
||
$table->text('two_factor_recovery_codes') | ||
->after('two_factor_secret') | ||
->nullable(); | ||
|
||
if (Fortify::confirmsTwoFactorAuthentication()) { | ||
$table->timestamp('two_factor_confirmed_at') | ||
->after('two_factor_recovery_codes') | ||
->nullable(); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->dropColumn(array_merge([ | ||
'two_factor_secret', | ||
'two_factor_recovery_codes', | ||
], Fortify::confirmsTwoFactorAuthentication() ? [ | ||
'two_factor_confirmed_at', | ||
] : [])); | ||
}); | ||
} | ||
}; |