Skip to content

Refactor: Use #[CurrentUser] attribute instead of auth()->user() and $request->user()#17

Merged
yilanboy merged 2 commits into
mainfrom
feature/current-user-attribute-2113602473801850390
Jun 29, 2026
Merged

Refactor: Use #[CurrentUser] attribute instead of auth()->user() and $request->user()#17
yilanboy merged 2 commits into
mainfrom
feature/current-user-attribute-2113602473801850390

Conversation

@yilanboy

Copy link
Copy Markdown
Owner

This PR refactors the codebase to make use of Laravel 11's #[CurrentUser] attribute for dependency injection, replacing the global auth()->user() helper and $request->user().

Key changes:

  • Injected #[CurrentUser] User $user into VerifyEmailController and GeneratePasskeyRegisterOptionsController and API routes instead of using $request->user().
  • Updated MatchOldPassword custom validation rule to accept the user via constructor property promotion, and changed its instantiation to app(MatchOldPassword::class).
  • Updated Livewire Volt components (e.g. ⚡header, ⚡create-modal, ⚡edit-modal) to inject the user in mount() and store it as a public property for the blade template.
  • Updated ⚡index.blade.php in notifications to resolve it directly in the render() method.

PR created automatically by Jules for task 2113602473801850390 started by @yilanboy

…and `$request->user()`

Replaced usages of `auth()->user()` and `$request->user()` with the new `#[CurrentUser]` attribute from Laravel 11.
Updated custom validation rules, Livewire components, routes, and controllers to use dependency injection.

Co-authored-by: yilanboy <27554321+yilanboy@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@yilanboy
yilanboy merged commit 7afd5bf into main Jun 29, 2026
2 checks passed
@yilanboy
yilanboy deleted the feature/current-user-attribute-2113602473801850390 branch June 29, 2026 08:37
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.

1 participant