GetCurrentUser
in package
Use case for getting the current authenticated user.
Tags
Table of Contents
Properties
- $cachedUser : User|null
- Cached current user.
- $repository : UserRepositoryInterface
- User repository.
Methods
- __construct() : mixed
- Create a new GetCurrentUser use case.
- clearCache() : void
- Clear the cached user.
- execute() : User|null
- Execute to get the current user.
Properties
$cachedUser
Cached current user.
private
User|null
$cachedUser
= null
$repository
User repository.
private
UserRepositoryInterface
$repository
Methods
__construct()
Create a new GetCurrentUser use case.
public
__construct(UserRepositoryInterface $repository) : mixed
Parameters
- $repository : UserRepositoryInterface
-
User repository
clearCache()
Clear the cached user.
public
clearCache() : void
execute()
Execute to get the current user.
public
execute() : User|null
Return values
User|null —The current user or null if not authenticated