如何在Laravel 8中使用Web路由为Auth Controller

发布于 2025-02-03 20:06:13 字数 887 浏览 3 评论 0原文

我想使用多步注册。但是在路线上遇到了麻烦。这是我的第一个路线。

Route::get('register-step2', [Auth\RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [Auth\RegisterStep2Controller::class, 'postForm'])
  ->name('register.step2');

但是它获得了错误

目标类[auth \ registhstep2controller]。

因此,我更改并与此代码混合。

Route::group(['middleware' => ['auth']], function() {
    Route::resource('roles', RoleController::class);
    Route::resource('users', UserController::class);
    Route::resource('products', ProductController::class);
    Route::get('register-step2', [RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [RegisterStep2Controller::class, 'postForm'])
  ->name('register.step2');

但是它说:目标类[registerStep2Controller]不存在。

如何在Laravel 8或9中的AUTH中使用控制器。

我想在Auth文件夹中使用registerstep2控制器。

I wanted to use multi step registration. But got trouble at route. This is my first route.

Route::get('register-step2', [Auth\RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [Auth\RegisterStep2Controller::class, 'postForm'])
  ->name('register.step2');

but it got error

Target class [Auth\RegisterStep2Controller] does not exist.

so I change and mix with this code.

Route::group(['middleware' => ['auth']], function() {
    Route::resource('roles', RoleController::class);
    Route::resource('users', UserController::class);
    Route::resource('products', ProductController::class);
    Route::get('register-step2', [RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [RegisterStep2Controller::class, 'postForm'])
  ->name('register.step2');

But it says that: Target class [RegisterStep2Controller] does not exist.

How to use controller in auth in laravel 8 or 9.

I wanted to use registerstep2 controller in auth folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋风の叶未落 2025-02-10 20:06:14

根据下面的

use App\Http\Controllers\Auth\RegisterStep2Controller;
...

Route::get('register-step2', [RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [RegisterStep2Controller::class, 'postForm'])->name('register.step2');

Make changes in your routes/web.php as per below

use App\Http\Controllers\Auth\RegisterStep2Controller;
...

Route::get('register-step2', [RegisterStep2Controller::class,'showForm']);
Route::post('register-step2', [RegisterStep2Controller::class, 'postForm'])->name('register.step2');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文