Skip to content

Refactor date handling using tick() helper in Auth and Model - #55

Open
fadrian06 wants to merge 1 commit into
leafsphp:v5.xfrom
fadrian06:simplify-leafs-date-usage
Open

Refactor date handling using tick() helper in Auth and Model#55
fadrian06 wants to merge 1 commit into
leafsphp:v5.xfrom
fadrian06:simplify-leafs-date-usage

Conversation

@fadrian06

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

This pull request refactors how timestamps are generated throughout the authentication system by replacing direct instantiation of the Date class with a global tick() function. Additionally, unused imports of the Date class are removed from relevant files. These changes simplify the codebase and ensure a consistent approach to timestamp handling.

Timestamp handling refactor:

  • Replaced (new Date())->tick()->format(Config::get('timestamps.format')) with tick()->format(Config::get('timestamps.format')) for generating timestamps in the register, update, and createUserFor methods in src/Auth.php. [1] [2] [3]
  • Updated the create and update methods in src/Auth/Model.php to use the tick() function for timestamp formatting. [1] [2]
  • Modified the update method in src/Auth/User.php to use the tick() function for updating timestamps.

Code cleanup:

  • Removed unused imports of the Date class from src/Auth/Model.php and src/Auth/User.php. [1] [2]

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Replace (new Date())->tick() with the tick() helper function to
simplify date handling and reduce boilerplate code. This also
allows for the removal of unused Leaf\Date imports across the
Auth, Model, and User classes.
Copilot AI lite review requested due to automatic review settings September 11, 2026 00:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

馃煝 Approval recommended

No unresolved review issues were identified.

Pull request overview

Refactors authentication timestamp generation to use the shared tick() helper and removes obsolete Date imports.

Changes:

  • Replaced direct Date instantiation with tick().
  • Cleaned up unused imports.
File summaries
File Description
src/Auth/User.php Uses tick() for user updates and removes the unused import.
src/Auth/Model.php Uses tick() for model timestamps and removes the unused import.
src/Auth.php Uses tick() for registration and update timestamps.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants