One more fix for MAC address weirdness

This commit is contained in:
snipe 2016-07-22 05:56:00 -07:00
parent d4138f4364
commit a590cc3dd2

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class OneMoreMacAddrFix extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
foreach(\App\Models\CustomField::all() as $custom_field) {
if ($custom_field->format=='regex:/^MAC$/') {
$custom_field->format = 'regex:/^[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}$/';
}
$custom_field->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}