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

Missing argument 1 for App\Http\Controllers\Controller::redirectTo() #1

Open
tortuetorche opened this issue Jan 23, 2017 · 0 comments
Labels

Comments

@tortuetorche
Copy link
Contributor

tortuetorche commented Jan 23, 2017

Since Laravel 5.3.29, if you get this Error Exception:

Missing argument 1 for App\Http\Controllers\Controller::redirectTo(),
called in /home/username/my_app/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php on line 15
and defined in /home/username/my_app/vendor/efficiently/jquery-laravel/src/Efficiently/JqueryLaravel/ControllerAdditions.php line 93

Here the workaround:
In your app/Http/Controllers/Auth/LoginController.php, app/Http/Controllers/Auth/RegisterController.php and app/Http/Controllers/Auth/ResetPasswordController.php files , you should replace the redirectTo() call to redirectUserTo().

//...
class LoginController extends Controller
{
    //...

    /**
     * Get the post register / login redirect path.
     * And keep Efficiently\JqueryLaravel\ControllerAdditions::redirectTo()
     *
     * @see https://github.com/efficiently/jquery-laravel/issues/1
     * @return string
     */
    public function redirectPath()
    {
        if (method_exists($this, 'redirectUserTo')) {
            return $this->redirectUserTo();
        }
        return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
    }
}

So the ControllerAdditions::redirectTo() method works again 😸

Source: laravel/framework#16896

@tortuetorche tortuetorche pinned this issue Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant