我正在努力更改由生成的时间戳列名称
php artisan migrate
命令。
我已经进行了以下更改。当我使用 eloquent 查询生成器时,它可以正确生成列名,但是当我使用上面的命令时,它仍然会生成“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我知道修改“核心”不是一个好主意。如果有人能告诉我扩展这些课程的最佳方式,我将不胜感激。