mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-25 09:42:10 +08:00
Merge branch 'log-ip-address' of https://github.com/johnroyer/BookStack into johnroyer-log-ip-address
This commit is contained in:
commit
8972f7b212
|
@ -11,6 +11,7 @@ use BookStack\Interfaces\Loggable;
|
|||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class ActivityService
|
||||
{
|
||||
|
@ -58,6 +59,7 @@ class ActivityService
|
|||
return $this->activity->newInstance()->forceFill([
|
||||
'type' => strtolower($type),
|
||||
'user_id' => user()->id,
|
||||
'ip' => Request::ip(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnIpIntoActivities extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->string('ip', 45)->after('user_id');
|
||||
|
||||
$table->index(['ip'], 'user_ip_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->dropIndex('user_ip_idx');
|
||||
$table->dropColumn('ip');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -117,6 +117,7 @@ return [
|
|||
'audit_deleted_item' => 'Deleted Item',
|
||||
'audit_deleted_item_name' => 'Name: :name',
|
||||
'audit_table_user' => 'User',
|
||||
'audit_table_user_ip' => 'User IP',
|
||||
'audit_table_event' => 'Event',
|
||||
'audit_table_related' => 'Related Item or Detail',
|
||||
'audit_table_date' => 'Activity Date',
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
<a href="{{ sortUrl('/settings/audit', $listDetails, ['sort' => 'key']) }}">{{ trans('settings.audit_table_event') }}</a>
|
||||
</th>
|
||||
<th>{{ trans('settings.audit_table_related') }}</th>
|
||||
<th>{{ trans('settings.audit_table_user_ip') }}</th>
|
||||
<th>
|
||||
<a href="{{ sortUrl('/settings/audit', $listDetails, ['sort' => 'created_at']) }}">{{ trans('settings.audit_table_date') }}</a></th>
|
||||
</tr>
|
||||
|
@ -88,6 +89,7 @@
|
|||
<div class="px-m">{{ $activity->detail }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $activity->ip }}</td>
|
||||
<td>{{ $activity->created_at }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
Loading…
Reference in New Issue
Block a user