You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at vendor\laravel\framework\src\Illuminate\Routing\RouteAction.php:92
88▕ */
89▕ protected static function makeInvokable($action)
90▕ {
91▕ if (! method_exists($action, '__invoke')) {
➜ 92▕ throw new UnexpectedValueException("Invalid route action: [{$action}].");
93▕ }
94▕
95▕ return $action.'@__invoke';
96▕ }
I'm just making a simple action just like this
<?php
namespace App\Actions\Auth\ForgetPasswordAction;
use Lorisleiva\Actions\Concerns\AsAction;
use App\Models\User;
use App\Models\PasswordReset;
use App\Actions\SendResetEmailAction;
class ForgetPasswordAction
{
use AsAction;
public function handle($email) : ForgetPassword {
$user = User::where('email', '=', $request->email)->first();
if (count($user) < 1) {
return redirect()->back()->withErrors(['email' => trans('User does not exist')]);
}
$sendEmail = SendResetEmailaction::run($email, 'random');
if ($sendEmail) {
return redirect()->back()->with('status', trans('A reset link has been sent to your email address.'));
} else {
return redirect()->back()->withErrors(['error' => trans('A Network Error occurred. Please try again.')]);
}
}
public function asController(Request $request): Response
{
$forgetpassword = $this->handle(
$request->get('email'),
);
return redirect()->route('forget.password', [$forgetpassword]);
}
}
this is the route
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Actions\Auth\ForgetPasswordAction;
Route::get('/forget-password', ForgetPasswordAction::class);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm new to laravel actions and I got an error
Invalid route action: [App\Actions\Auth\ForgetPasswordAction].
at vendor\laravel\framework\src\Illuminate\Routing\RouteAction.php:92
88▕ */
89▕ protected static function makeInvokable($action)
90▕ {
91▕ if (! method_exists($action, '__invoke')) {
➜ 92▕ throw new UnexpectedValueException("Invalid route action: [{$action}].");
93▕ }
94▕
95▕ return $action.'@__invoke';
96▕ }
I'm just making a simple action just like this
this is the route
can anyone help me to find out the problem
Beta Was this translation helpful? Give feedback.
All reactions