Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[12.x] chore: return Collection from timestamps methods #55871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions 31 src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,13 +1239,14 @@ public function timestampTz($column, $precision = null)
* Add nullable creation and update timestamps to the table.
*
* @param int|null $precision
* @return void
* @return Illuminate\Support\Collection<int, \Illuminate\Database\Schema\ColumnDefinition>
*/
public function timestamps($precision = null)
{
$this->timestamp('created_at', $precision)->nullable();

$this->timestamp('updated_at', $precision)->nullable();
return new Collection([
$this->timestamp('created_at', $precision)->nullable(),
$this->timestamp('updated_at', $precision)->nullable(),
]);
}

/**
Expand All @@ -1254,37 +1255,39 @@ public function timestamps($precision = null)
* Alias for self::timestamps().
*
* @param int|null $precision
* @return void
* @return Illuminate\Support\Collection<int, \Illuminate\Database\Schema\ColumnDefinition>
*/
public function nullableTimestamps($precision = null)
{
$this->timestamps($precision);
return $this->timestamps($precision);
}

/**
* Add creation and update timestampTz columns to the table.
*
* @param int|null $precision
* @return void
* @return Illuminate\Support\Collection<int, \Illuminate\Database\Schema\ColumnDefinition>
*/
public function timestampsTz($precision = null)
{
$this->timestampTz('created_at', $precision)->nullable();

$this->timestampTz('updated_at', $precision)->nullable();
return new Collection([
$this->timestampTz('created_at', $precision)->nullable(),
$this->timestampTz('updated_at', $precision)->nullable(),
]);
}

/**
* Add creation and update datetime columns to the table.
*
* @param int|null $precision
* @return void
* @return Illuminate\Support\Collection<int, \Illuminate\Database\Schema\ColumnDefinition>
*/
public function datetimes($precision = null)
{
$this->datetime('created_at', $precision)->nullable();

$this->datetime('updated_at', $precision)->nullable();
return new Collection([
$this->datetime('created_at', $precision)->nullable(),
$this->datetime('updated_at', $precision)->nullable(),
]);
}

/**
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.