Migrate V1 Api keys by hashing them

This commit is contained in:
Jérémy Munsch 2021-08-12 15:25:34 +02:00
parent f59deac5fc
commit aaab3bcf3c

View file

@ -0,0 +1,30 @@
<?php
use App\Models\Service;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Hash;
class HashApiKeysInServicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
foreach (Service::all() as $service) {
$service->bearer_token = Hash::make($service->bearer_token);
$service->saveOrFail();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}