jesse_orange_newable
4 months ago
444
3
Laravel

Unknown error when logging out

Posted 4 months ago by jesse_orange_newable

In my application I decided to make my own LogoutController as I didn't see the necessity of using Auth::routes


<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;

class LogoutController extends Controller
{
    /**
     * Logout and redirect to the login page
     *
     * @return void
     */
    public function logout(Request $request)
    {
        Auth::logout();

        $request->session()->invalidate();

        $request->session()->regenerateToken();

        return redirect()->route('login.ms');
    }
}

However, every time i try to actually log out i get the following error:

Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [ $request ]] in class Illuminate\Http\Client\Request

I've never seen this error in my life and I'm certain it refers to something being added to the container but am unsure why this affects logging out specifically.

Please sign in or create an account to participate in this conversation.