FEATURE #1532: add ip and user agent into logged information
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIpAndUserAgentIntoLog extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('action_log', function (Blueprint $table) {
|
||||
$table->string('ip')
|
||||
->after('user_id')
|
||||
->comment('User\'s IP Address');
|
||||
$table->mediumText('user_agent')
|
||||
->after('ip')
|
||||
->comment('Browser string of client, who performed some action.');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('action_log', function (Blueprint $table) {
|
||||
$table->dropColumn('ip');
|
||||
$table->dropColumn('user_agent');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -27,15 +27,27 @@ class SeedActionLogTypes extends Seeder
|
||||
'removeWidgetFromArea',
|
||||
'editWidget',
|
||||
'editWidgetArea',
|
||||
'invalidEditContentAttempt',
|
||||
'createNewContent',
|
||||
'deleteContent',
|
||||
'publishContent',
|
||||
'draftFromContent',
|
||||
'editContent',
|
||||
'setHomepage',
|
||||
];
|
||||
|
||||
foreach ($types as $type) {
|
||||
\DB::table('action_log_types')
|
||||
->insert([
|
||||
'string_id' => $type,
|
||||
'name' => 'admin/actionLog.name' . ucfirst($type),
|
||||
'value' => 'admin/actionLog.' . $type
|
||||
]);
|
||||
try {
|
||||
\DB::table('action_log_types')
|
||||
->insert([
|
||||
'string_id' => $type,
|
||||
'name' => 'admin/actionLog.name' . ucfirst($type),
|
||||
'value' => 'admin/actionLog.' . $type
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
// ignore exception
|
||||
echo $type . ' already seeded' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user