Php Laravel 8:如何修复ParseError语法错误,意外'';

Php Laravel 8:如何修复ParseError语法错误,意外'';,php,laravel,laravel-8,Php,Laravel,Laravel 8,我知道这个问题可能听起来很愚蠢,但我正在与Laravel合作,我想为我的一条路线返回一条警报消息,该路线位于团体路线内: Route::middleware('auth')->group(function(){ Route::get('profile', [App\Http\Controllers\ProfileController::class, 'index'])->name('profile'){ alert()->success('welcome

我知道这个问题可能听起来很愚蠢,但我正在与Laravel合作,我想为我的一条路线返回一条警报消息,该路线位于团体路线内:

Route::middleware('auth')->group(function(){
    Route::get('profile', [App\Http\Controllers\ProfileController::class, 'index'])->name('profile'){
        alert()->success('welcome','message')->persistent('Ok');
    }
    Route::get('profile/twofactor', [App\Http\Controllers\ProfileController::class, 'manageTwoFactor'])->name('profile.2fa.manage');
    Route::post('profile/twofactor', [App\Http\Controllers\ProfileController::class, 'postManageTwoFactor']);
});
如您所见,对于路由
配置文件
我已经设置了此消息,但是我得到了
ParseError语法错误,意外的“;”

不幸的是,我不知道如何以正确的方式做到这一点

如果你知道的话,请帮帮我

谢谢

检查该行:

Route::get('profile', [App\Http\Controllers\ProfileController::class, 'index'])->name('profile'){
    alert()->success('welcome','message')->persistent('Ok');
}
您在
alert()…
周围有大括号,这是错误的

您应该将其更改为:

Route::get('profile', [App\Http\Controllers\ProfileController::class, 'index'])->name('profile');

并移动
alert()->success('welcome','message')->persistent('Ok')到ProfileController类的索引方法。

因为错误说明您忘记放置;在您的路线警报之后end@NurbekBoymurodov如果您是指这一行:
alert()->success('welcome','message')->persistent('Ok')
,则以
结尾不在那里检查thisRoute::get('profile',[App\Http\Controllers\ProfileController::class,'index'])->name('profile'){alert()->success('welcome','message')->persistent('Ok');};here@NurbekBoymurodov没有人!我试过那个,但没有解决问题。