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

[Refactor] Refactoring Usage of Dynamic Values in HasDraft Trait #48

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

kinkaz
Copy link
Contributor

@kinkaz kinkaz commented Mar 6, 2024

This pull request aims to refactor usages in the HasDraft trait, specifically addressing instances where column names for soft delete and timestamps were not utilizing dynamic values. Previously, static values such as CREATED_AT, UPDATED_AT, and DELETED_AT were hardcoded, leading to potential issues.

class Page extends Model
{
    use SoftDeletes;
    use HasDrafts;

    const CREATED_AT = 'created'; // not taken into account
    const UPDATED_AT = 'modified'; // not taken into account
    const DELETED_AT = 'deleted'; // not taken into account
}

Changes made :

  • Modified strings and properties utilizing the dynamic values (updated_at, modified_at, deleted_at) provided by their respective model methods. This change enhances flexibility and adherence to best practices within Laravel.

Additional Notes :

  • No breaking changes are introduced by this refactoring and all tests are passing.

@oddvalue oddvalue merged commit d02934b into oddvalue:main Mar 6, 2024
11 checks passed
@oddvalue
Copy link
Owner

oddvalue commented Mar 6, 2024

Thanks

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