Skip to content

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

Description

@tortuetorche

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions