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

Updated By should not be updated if there is no user authenticated #16

Closed
22Nick22 opened this issue Mar 5, 2021 · 0 comments · Fixed by #17
Closed

Updated By should not be updated if there is no user authenticated #16

22Nick22 opened this issue Mar 5, 2021 · 0 comments · Fixed by #17

Comments

@22Nick22
Copy link
Contributor

22Nick22 commented Mar 5, 2021

Summary of problem or feature request

Setting the updated_by field in a Factory has no effect as the value is overwritten by null on save due to there being no currently authenticated user.

Code snippet of problem

    public function definition()
    {
        return [
            'name' => $this->faker->name,
            'email' => $this->faker->unique()->safeEmail,
            'email_verified_at' => now(),
            'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
            'remember_token' => Str::random(10),
            'created_by' => 3, // Stamped as 3
            'updated_by' => 3, // Stamped as NULL
        ];
    }

System details

  • Operating System - PopOS
  • PHP Version - 7.4.9
  • Laravel Version - 8.21.0
  • Laravel-Auditable Version - 4.3.0
22Nick22 added a commit to 22Nick22/laravel-auditable that referenced this issue Jun 2, 2021
Don't clear updated_by if the current user is not
authenticated. Allows setting updated_by in factories.

Fix yajra#16
@yajra yajra closed this as completed in #17 Jun 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant