Skip to content

[9.x] Have Model::withoutTimestamps() return the callback's return value - #44457

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
axlon:without-timestamps
Oct 4, 2022
Merged

[9.x] Have Model::withoutTimestamps() return the callback's return value#44457
taylorotwell merged 1 commit into
laravel:9.xfrom
axlon:without-timestamps

Conversation

@axlon

@axlon axlon commented Oct 4, 2022

Copy link
Copy Markdown
Contributor

#44138 introduced the ability to perform actions on models without timestamps.

This PR makes Model::withoutTimestamps() act the same as Model::withoutEvents(), Model::withoutTimestampsOn() and various other "without" methods, by having it return the callbacks return value.

This would then allow e.g.:

$user = User::withoutTimestamps(fn () => User::create($request->validated());

@axlon axlon changed the title [9.x] Have Model::withoutTimestamps() return the callback's value [9.x] Have Model::withoutTimestamps() return the callback's return value Oct 4, 2022
@taylorotwell
taylorotwell merged commit 03795ab into laravel:9.x Oct 4, 2022
@axlon
axlon deleted the without-timestamps branch October 4, 2022 18:54

@internetbuilder internetbuilder left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants