App\Http\Middleware\IsStalePassword::handle PHP Method

handle() public method

Check if the users password was changed within last 6 months or not If not ask to change the password, before the user can log in
public handle ( Illuminate\Http\Request $request, Closure $next ) : mixed
$request Illuminate\Http\Request
$next Closure
return mixed
    public function handle($request, Closure $next)
    {
        $last_pw_changed = new Carbon(current_user()->last_pw_changed);
        if (Carbon::now()->diffInDays(current_user()->created_at) >= 180 && Carbon::now()->diffInDays($last_pw_changed) > 180) {
            return Redirect::to(Request::segment(1) . '/users/change-password')->with('error_message', trans('users.pw_change_6_months'));
        }
        return $next($request);
    }
IsStalePassword