Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Argument 1 passed to App\Http\Controllers\Auth\LoginController::attemptLogin() must be an instance of App\Http\Controllers\Auth\Request

I am adding 1 attribute for authentication, but it doesn't work. i'm not change anything except

adding this 2 method in my LoginController

protected function credentials(Request $request)
    {
        return $request->only($this->username(), 'password', 'division_id');
    }
/**
 * Attempt to log the user into the application.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return bool
 */


protected function attemptLogin(Request $request)
{
    $request->merge(['division_id' => '1']);
    return $this->guard()->attempt(
        $this->credentials($request), $request->filled('remember')
    );
}

I want to user login just exact division_id 1

like image 946
Ray Coder Avatar asked Jan 09 '19 02:01

Ray Coder


1 Answers

import the request class with use \Illuminate\Http\Request; at the top of the LoginController.

That should fix it ;)

like image 78
Ismoil Shifoev Avatar answered Nov 11 '22 15:11

Ismoil Shifoev