在 Laravel Eloquent 中使用自定义时间戳列

发布: (2025年12月19日 GMT+8 23:58)
1 min read
原文: Dev.to

Source: Dev.to

自定义时间戳列

如果需要自定义 created_atupdated_at 的列名,可以在数据库层面进行设置。

/**
 * Run the migrations.
 */
public function up(): void
{
    Schema::create('items', function (Blueprint $table) {
        $table->id();
        $table->string('title');
        // Custom...
    });
}
Back to Blog

相关文章

阅读更多 »