* @property string $user_agent;
* @property User $user;
* @property int $user_id;
+ * @property string $session_id
*
*/
class AccessLog extends Model
$entry->user_id = Auth::check() ? Auth::user()->id : null;
$entry->user_agent = $request->userAgent();
$entry->file_id = $file ? $file->id : null;
+ $entry->session_id = \Session::getId();
$entry->save();
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddSessionDataToActivityLog extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('access_logs', function (Blueprint $table) {
+ $table->text('session_id')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('access_logs', function (Blueprint $table) {
+ $table->dropColumn('session_id');
+ });
+ }
+}