Skip to content
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

[5.3] Change read to timestamp from boolean #14797

Merged
merged 4 commits into from
Aug 16, 2016
Merged

[5.3] Change read to timestamp from boolean #14797

merged 4 commits into from
Aug 16, 2016

Conversation

alexbowers
Copy link
Contributor

No description provided.

@GrahamCampbell GrahamCampbell changed the title Change read to timestamp from boolean [5.3] Change read to timestamp from boolean Aug 12, 2016
@alexbowers
Copy link
Contributor Author

Im unsure if this should be timestamp or datetime in the stub

@@ -52,7 +53,7 @@ public function notifiable()
*/
public function markAsRead()
{
$this->forceFill(['read' => true])->save();
$this->forceFill(['read' => Carbon::now()])->save();
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought, could do $this->freshTimestamp() here instead - would give you a new Carbon instance and save needing to add the use statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've never used that before.

Is it done like this:

$this->forceFill(['read' => $this->freshTimestamp()])->save();

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah - that's the one!

@antonkomarev
Copy link
Contributor

antonkomarev commented Aug 14, 2016

Maybe it should be named read_at to follow consistency of naming timestamp fields? Like created_at, updated_at, deleted_at.

@tomschlick
Copy link
Contributor

+1 for read_at

@taylorotwell taylorotwell merged commit 6af19d3 into laravel:5.3 Aug 16, 2016
@taylorotwell
Copy link
Member

Could you send PR to docs when you get a chance. Thanks!

@alexbowers
Copy link
Contributor Author

@taylor I have documented this on the docs branch, but there is a merge conflict, so feel free to take the deltas and just apply them yourself :)

@alexbowers alexbowers deleted the feature/notification-timestamps branch August 16, 2016 09:21
tillkruss pushed a commit to tillkruss/framework that referenced this pull request Aug 30, 2016
* Change read to timestamp from boolean

* Use timestamps not datetime

* Dont use carbon, instead use freshTimstamp()

* Use read_at not read
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.

5 participants