Laravel-未找到列:1054未知列';ip地址';

Laravel-未找到列:1054未知列';ip地址';,laravel,Laravel,在Laravel-8应用程序中,我尝试使用此功能: public static function addToLog($subject, $logType=null, $subjectHint=null) { $log = []; $log['subject'] = $subject; $log['log_type'] = $logType; $log['subject_hint'] = $subjectHint; $log['log_url'] = Req

在Laravel-8应用程序中,我尝试使用此功能:

public static function addToLog($subject, $logType=null, $subjectHint=null)
{
    $log = [];
    $log['subject'] = $subject;
    $log['log_type'] = $logType;
    $log['subject_hint'] = $subjectHint;
    $log['log_url'] = Request::fullUrl();
    $log['log_method'] = Request::method();
    $log['ip_address'] = Request::ip();
    $log['agent'] = Request::header('user-agent');
    $log['user_id'] = auth()->check() ? auth()->user()->id : 1;
    LogActivityModel::create($log);
}
但我有一个错误:

[2021-05-19 13:25:55]local.ERROR:PDOException:SQLSTATE[42S22]:找不到列:在C:\xampp\htdocs\myapp\vendor\laravel\framework\src\lighted\Database\Connection.php:465中的“字段列表”中的1054未知列“ip_地址”

但ip_地址列存在

以下是我的迁移:

public function up()
{
    Schema::create('user_log_activities', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->bigInteger('user_id')->nullable()->unsigned();
        $table->string('log_url', 300)->nullable();
        $table->string('log_method', 20)->nullable();
        $table->string('log_type', 50)->nullable();
        $table->string('subject', 200)->nullable();
        $table->string('subject_hint', 20)->nullable();
        $table->string('id_address', 64)->nullable();
        $table->string('agent', 300)->nullable();
        $table->timestamps();
    });
}
我如何解决它


谢谢

在迁移过程中,您收到了错误的列名。请将其更改为ip\u地址,而不是id\u地址。像这样的

 $table->string('ip_address', 64)->nullable();

你的迁移是什么?@brombeer-我已经添加了迁移,请在迁移中添加LogActivityModel,在名为“id\U地址”的列中添加,而在名为“ip\U地址”的控制器代码中,你应该将它们联合起来!它们的列是否存在于模型可填充属性中?