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

Add method DI #577

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Http/Controllers/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@ protected function loginPipeline(LoginRequest $request)
* Destroy an authenticated session.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Auth\StatefulGuard|null $guard
* @return \Laravel\Fortify\Contracts\LogoutResponse
*/
public function destroy(Request $request): LogoutResponse
public function destroy(Request $request, StatefulGuard|null $guard = null): LogoutResponse
{
if ($guard) {
$this->guard = $guard;
}

$this->guard->logout();

if ($request->hasSession()) {
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ public function show(Request $request)
* Confirm the user's password.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Auth\StatefulGuard|null $guard
* @return \Illuminate\Contracts\Support\Responsable
*/
public function store(Request $request)
public function store(Request $request, StatefulGuard|null $guard = null)
{
if ($guard) {
$this->guard = $guard;
}

$confirmed = app(ConfirmPassword::class)(
$this->guard, $request->user(), $request->input('password')
);
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/NewPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ public function create(Request $request): ResetPasswordViewResponse
* Reset the user's password.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Auth\StatefulGuard|null $guard
* @return \Illuminate\Contracts\Support\Responsable
*/
public function store(Request $request): Responsable
public function store(Request $request, StatefulGuard|null $guard = null): Responsable
{
if ($guard) {
$this->guard = $guard;
}

$request->validate([
'token' => 'required',
Fortify::email() => 'required|email',
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ public function create(Request $request): RegisterViewResponse
*
* @param \Illuminate\Http\Request $request
* @param \Laravel\Fortify\Contracts\CreatesNewUsers $creator
* @param \Illuminate\Contracts\Auth\StatefulGuard|null $guard
* @return \Laravel\Fortify\Contracts\RegisterResponse
*/
public function store(Request $request,
CreatesNewUsers $creator): RegisterResponse
CreatesNewUsers $creator, StatefulGuard|null $guard = null): RegisterResponse
{
if ($guard) {
$this->guard = $guard;
}

if (config('fortify.lowercase_usernames')) {
$request->merge([
Fortify::username() => Str::lower($request->{Fortify::username()}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ public function create(TwoFactorLoginRequest $request): TwoFactorChallengeViewRe
* Attempt to authenticate a new session using the two factor authentication code.
*
* @param \Laravel\Fortify\Http\Requests\TwoFactorLoginRequest $request
* @param \Illuminate\Contracts\Auth\StatefulGuard|null $guard
* @return mixed
*/
public function store(TwoFactorLoginRequest $request)
public function store(TwoFactorLoginRequest $request, StatefulGuard|null $guard = null)
{
if ($guard) {
$this->guard = $guard;
}

$user = $request->challengedUser();

if ($code = $request->validRecoveryCode()) {
Expand Down