I am trying to define a Global Session Variable in Login Controller of Laravel 6.
protected function authenticated(Request $request, $user)
{
$branch_id = auth()->user()->branch_id;
session()->put('lbranch', $branch_id);
if ($branch_id==0){
$branchid = Branch::first('id');
session()->put('lbranch', $branchid->id);
}
}
But I am getting the following error :
Argument 1 passed to App\Http\Controllers\Auth\LoginController::authenticated() must be an instance of App\Http\Controllers\Auth\Request, instance of Illuminate\Http\Request given, called in E:\ZAH\Laravel\myaccounts\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php on line 111
When I change :
use App\Http\Controllers\Auth\Request;
with
use Illuminate\Http\Request;
everything works fine. My question is what is the proper way of using authenticated function with Auth request.