1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-17 00:22:51 +01:00
invoiceninja/database/migrations/2015_11_01_080417_encrypt_tokens.php
2017-01-30 21:40:43 +02:00

39 lines
939 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
class EncryptTokens extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$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)]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$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)]);
}
}
}