user(); if(!$message){//如果没传message $message = (OperationType::types()[$type->value] ?? '') .'-'. __("models.".($model ? $model::class : "")). '【'.($model?->name ?? ($model?->id ?? 0)) .'】'; } $data = [ 'user_id' => $user?->id ?? 0, 'user_name' => $user?->name ?? '', 'message' => $message, 'data_type' => $model ? $model::class : '', 'data_id' => $model?->id ?? null, 'type' => $type, 'input_data' => $parms, 'created_at' => now(), 'updated_at' => now(), ]; OperationLog::create($data); } }