mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 19:37:32 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			936 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			936 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
use Illuminate\Database\Schema\Blueprint;
 | 
						|
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)]);
 | 
						|
        }
 | 
						|
 | 
						|
	}
 | 
						|
 | 
						|
}
 |