Create schemas and models for implementing generic policies#1177
Open
tarrow wants to merge 11 commits into
Open
Create schemas and models for implementing generic policies#1177tarrow wants to merge 11 commits into
tarrow wants to merge 11 commits into
Conversation
Contributor
Author
|
@outdooracorn on your return can you take a look at b40bc27 and see if you agree with this change? I assume you very explicitly decided to try and make the built in timestamps ( I did quite some research and from what I could read upstream making the built in timestamps nullable was a very explicit nearly decade old decision to handle mysql/maria. |
d820df4 to
45b9423
Compare
We are using the built in Eqloquent timestamp method to introduce nullable timestamp columns. The framework seems to have discussed these issues at length[1] and determined that this is the best setup to prevent issues with ON UPDATE CURRENT_TIMESTAMP behaviour. [1] laravel/framework#12490
For nice to have's like Factory and Seeder we should do in a follow-up. Still need to come to a decision on casting the timestamps; particularly the built in.
Run php artisan ide-helper:models --reset "App\PolicyAcceptance" "App\Policy"
4d83fdd to
4f36d78
Compare
dati18
requested changes
Jun 25, 2026
dati18
requested changes
Jun 25, 2026
dati18
reviewed
Jun 25, 2026
de0d29d to
b96b645
Compare
dati18
reviewed
Jun 25, 2026
| 'accepted_at' => CarbonImmutable::createFromDate(2026, 1, 1), | ||
| ] | ||
| ); | ||
| $this->assertNull($policyAcceptance->accepted_at); |
Contributor
There was a problem hiding this comment.
put the instance assertion here too is not a bad idea $this->assertInstanceOf(CarbonImmutable::class, $policyAcceptance->accepted_at);
Contributor
Author
There was a problem hiding this comment.
I think that's not possible: null isn't an instance of CarbonImmutable
dati18
reviewed
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Models, Migrations and simple Tests for Policy and PolicyAcceptance.
Using built in
created_atandupdated_attimestamps for consistency with our other models,Does not include Factories or Seeders. Possibility for a follow up.
Bug: T428175