Add IP Aliasing (#72)
* complete support for IP Alias's throughout panel Includes a database change and probably better allocation handling anyways closes #37
This commit is contained in:
parent
f1a3008a50
commit
e8c175f385
14 changed files with 206 additions and 76 deletions
42
database/migrations/2016_08_30_212718_add_ip_alias.php
Normal file
42
database/migrations/2016_08_30_212718_add_ip_alias.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIpAlias extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('allocations', function (Blueprint $table) {
|
||||
$table->text('ip_alias')->nullable()->after('ip');
|
||||
});
|
||||
|
||||
$allocations = DB::select('SELECT id, ip FROM allocations');
|
||||
foreach($allocations as $allocation) {
|
||||
DB::update(
|
||||
'UPDATE allocations SET ip_alias = :ip WHERE id = :id',
|
||||
[
|
||||
'ip' => $allocation->ip,
|
||||
'id' => $allocation->id
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('allocations', function (Blueprint $table) {
|
||||
$table->dropColumn('ip_alias');
|
||||
});
|
||||
}
|
||||
}
|
Reference in a new issue