2015-11-01 19:21:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
2017-01-30 17:05:31 +01:00
|
|
|
class EncryptTokens extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2015-11-01 19:21:11 +01:00
|
|
|
$gateways = DB::table('account_gateways')
|
|
|
|
->get(['id', 'config']);
|
|
|
|
foreach ($gateways as $gateway) {
|
|
|
|
DB::table('account_gateways')
|
|
|
|
->where('id', $gateway->id)
|
|
|
|
->update(['config' => Crypt::encrypt($gateway->config)]);
|
|
|
|
}
|
2017-01-30 17:05:31 +01:00
|
|
|
}
|
2015-11-01 19:21:11 +01:00
|
|
|
|
2017-01-30 17:05:31 +01:00
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2015-11-01 19:21:11 +01:00
|
|
|
$gateways = DB::table('account_gateways')
|
|
|
|
->get(['id', 'config']);
|
|
|
|
foreach ($gateways as $gateway) {
|
|
|
|
DB::table('account_gateways')
|
|
|
|
->where('id', $gateway->id)
|
|
|
|
->update(['config' => Crypt::decrypt($gateway->config)]);
|
|
|
|
}
|
2017-01-30 17:05:31 +01:00
|
|
|
}
|
2015-11-01 19:21:11 +01:00
|
|
|
}
|