Updated_at 即使时间戳为 false,仍在更新

Updated_at still being updated even with timestamps to false

我正在将我的数据库从 prestashop 迁移到 laravel,所以我想保留相同的数据(包括创建和更新日期)。但是我的商店模型中的 updated_at 列会不断更新,即使时间戳设置为 false。

    $data = request()->validate([
        'name' => 'required|string',
        'iban' => 'sometimes|required|iban',
        'contact' => 'required|array',
        'contact.first_name' => 'required|string',
        'contact.last_name' => 'required|string',
        'contact.email' => 'required|string|unique:users,email',
        'contact.phone' => 'nullable|string',
        'billing_address' => 'sometimes|required|array',
        'billing_address.street_address' => 'sometimes|required|string',
        'billing_address.complement' => 'nullable|string',
        'billing_address.postal_code' => 'sometimes|required|string',
        'billing_address.city' => 'sometimes|required|string',
        'billing_address.country' => 'sometimes|required|string',
        'billing_address.region' => 'nullable|string',
        'created_at' => 'required|date',
        'updated_at' => 'required|date',
    ]);
    $store = app('store')->create(array_merge($data, [
        'status' => Store::STATUS_DRAFT,
        'type' => 'default',
        'company' => '',
        'tos_accepted_at' => null,
    ]));
    if (isset($data['billing_address'])) {
        $billing_address = $store->addresses()->create($data['billing_address']);
        $store->billing_address()->associate($billing_address);
    }
    $contact = $store->users()->create(array_merge($data['contact'], [
        'role' => 'user',
        'locale' => 'fr',
        'country' => optional($store->billing_address)->country ?? 'fr',
        'temporary_password' => 1,
        'password' => '',
    ]));
    $store->contact()->associate($contact);
    $store->timestamps = false;
    $store->save();

好的,我正在尝试欺骗 Laravel。

$store = app('store')->create(array_merge($data, [
    'status' => Store::STATUS_DRAFT,
    'type' => 'default',
    'company' => '',
    'tos_accepted_at' => null,
]));

$store->setCreatedAt($data['created_at']);
$store->setUpdatedAt($data['updated_at']);

$store->save();