9

によって生成されるタイムスタンプ列名を変更するのに苦労しています

php artisan migrate

指図。

私はすでに次の変更を行っています。雄弁なクエリビルダーを使用すると、列名を正しく生成できますが、上記のコマンドを使用すると、「created_at」、「updated_at」、および「deleted_at」が生成されます。誰でも私を助けることができますか?どうもありがとう。

/* vendor\framework\src\Illuminate\Database\Eloquent\Model.php */

/**
 * The name of the "created at" column.
 *
 * @var string
 */
const CREATED_AT = 'datetime_created';

/**
 * The name of the "updated at" column.
 *
 * @var string
 */
const UPDATED_AT = 'datetime_updated';

/**
 * The name of the "deleted at" column.
 *
 * @var string
 */
const DELETED_AT = 'datetime_deleted';

/* vendor\framework\src\Illuminate\Database\Schema\Blueprint.php */

/**
 * Indicate that the timestamp columns should be dropped.
 *
 * @return void
 */
public function dropTimestamps()
{
    $this->dropColumn('datetime_created', 'datetime_updated');
}

/**
 * Add a "deleted at" timestamp for the table.
 *
 * @return void
 */
public function softDeletes()
{
    $this->timestamp('datetime_deleted')->nullable();
}
/**
 * Add creation and update timestamps to the table.
 *
 * @return void
 */
public function timestamps()
{
    $this->timestamp('datetime_created');

    $this->timestamp('datetime_updated');
}
/**
 * Add a "deleted at" timestamp for the table.
 *
 * @return void
 */
public function softDeletes()
{
    $this->timestamp('datetime_deleted')->nullable();
}

PS「コア」を変更することはお勧めできません。誰かがこれらのクラスを拡張する最良の方法を教えてくれれば、本当に感謝しています。

4

1 に答える 1