rap-2-h
rap-2-h

Reputation: 32038

difference between timestamps and nullableTimestamps in Laravel 5.4 migration

According to Laravel documentation:

I don't understand. In other words, what I read is:

What did I miss?

Upvotes: 0

Views: 528

Answers (1)

peterm
peterm

Reputation: 92805

Since Laravel 5.2 there is no difference. If you look at the source you'll see that nullableTimestamps() is an alias for timestamps()

/**
 * Add nullable creation and update timestamps to the table.
 *
 * @return void
 */
public function timestamps()
{
    $this->timestamp('created_at')->nullable();
    $this->timestamp('updated_at')->nullable();
}

/**
 * Add nullable creation and update timestamps to the table.
 *
 * Alias for self::timestamps().
 *
 * @return void
 */
public function nullableTimestamps()
{
    $this->timestamps();
}

Upvotes: 2

Related Questions