LoginSignup
3
1

More than 1 year has passed since last update.

【Laravel】timestamps()とtimestamp()の違い

Posted at

環境

Laravel v9.5.1 (PHP v8.1.3)

timestamps()

created_atおよびupdated_atTIMESTAMPカラムを作成。

$table->timestamps();

timestamp()

created_atおよびupdated_at以外のカラム名でTIMESTAMPカラムを作成したいとき使える。

$table->timestamp('expired_at');

よくありそうなミス

この2つの違いを知らずに、下記のようにしていてmigrationできなかったので教訓にしたい。

$table->timestamps('expired_at');
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1