Skip to content

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

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
Oct 4, 2022
Merged

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

merged 1 commit into from
Oct 4, 2022

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Oct 4, 2022

#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
Copy link

@internetbuilder internetbuilder left a comment

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.

None yet

3 participants