mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 14:53:45 +02:00
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:
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 New Issue
Block a user