為什麼我設定了某個欄位類型為timestamps,但是他並沒有像我預期的一樣在更新或新增的時候自動填入當前時間戳記?
還有我用Laravel的migrate產生的資料表也一樣,產生的表裡面那個timestamps欄位根本不起效果。是怎麼回事?
這是migration檔
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <code><?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEquip extends Migration
{
public function up()
{
Schema::create( 'equip' , function (Blueprint $table ) {
$table ->smallInteger( 'equip_id' )->unsigned()->comment( '装备id' );
$table ->string( 'eqiup_name' )->comment( '装备名称' );
$table ->string( 'eqiup_desc' )->comment( '装备描述' );
$table ->timestamps();
$table ->primary( 'equip_id' );
});
}
public function down()
{
}
}
</code>
|
登入後複製