1
votes

I seem to get this issue every time I make a new invokable controller with a route. Can anyone help me fix it? I've tried deleting and remaking the class, remaking the route, it seems to hate it?

God knows how I got my ones before this working.

Route:

Route::post('user/forgot', 'Auth/ForgotPasswordController');

Controller;

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
    use SendsPasswordResetEmails;

    public function __invoke()
    {
        return $this->sendResetLinkEmail(request());
    }
}
3

3 Answers

1
votes

You almost had it!

Route::post('user/forgot', 'Auth/ForgotPasswordController');

Notice the / in the second paramater Auth/ForgotPasswordController

You need to change it to \, because this is the character for indicating a namespace.

0
votes

In your post route, you have not specified method name, list your route using

php artisan route:list

you must see route like this,

| POST | password/email| password.email| App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail     | web,guest                                                                                                                

you can do this way if you want to change default Auth route structure,

Route::post('user/forgot', 'Auth/ForgotPasswordController@sendResetLinkEmail');

0
votes

Parameters are case-sensitive. Make sure namespaces perfectly match the case of your directory hierarchy and class names.