Laravel hydrate 不使用所有字段

Laravel hydrate not using all fields

我有两个 table,operationsupload_operations。每天我都会 运行 将一组新数据导入 upload_operations,然后 运行 在 Nova 中执行一些操作来比较、更新和添加来自 upload_operations 变成 operations。我的一项操作没有按预期工作:

public function handle()
    {
        $new_uploads = DB::select('
            SELECT
            *
            FROM
            upload_operations u
            LEFT JOIN operations o USING (operation_id)
            WHERE
            o.operation_id IS NULL');
        $new_operations = UploadOperation::hydrate($new_uploads);

        Log::info('New operations count: ' . $new_operations->count());

        foreach ($new_operations->chunk(25) as $chunk) {
            foreach($chunk as $no) {
                Operation::create([
                    'certifier_name' => $no->certifier_name,
                    'certifier_website' => $no->certifier_website,
                    'certifier_email_address' => $no->certifier_email_address,
                    'operation_id' => $no->operation_id,
                    'operation_name' => $no->operation_name,
                    ...
                    // rest of rows
                    ...
                ]);
            }
        }

        return Action::message('New uploads added!');
    }

SQL 语句有效。使用我当前的数据,它 returns 63 行,每一列都填充了数据。但是,当我 运行 操作时,我的数据库有 63 条记录,其中除 operation_id(主键)外的所有列均为空白。

我是在滥用 hydrate() 吗?有没有更好的方法可以将这些记录插入 operations table?

尽管 SQL 在 TablePlus 中有效,但 Laravel 并未 select 所有列。我通过必须显式 select SQL.

中的每一列来修复它