重定向到受中间件laravel保护的路由

重定向到受中间件laravel保护的路由,laravel,redirect,routes,middleware,Laravel,Redirect,Routes,Middleware,我用guest中间件保护仪表板,我想用ID为每个雇主显示仪表板,但我不知道如何在guest中间件中获取ID我尝试了stackoverflow的一些解决方案,但返回的ID为空 public function handle($request, Closure $next, $guard = null,$id) { $employer=Employer::find($id); if (Auth::guard($guard)->check()) return re

我用guest中间件保护仪表板,我想用ID为每个雇主显示仪表板,但我不知道如何在guest中间件中获取ID我尝试了stackoverflow的一些解决方案,但返回的ID为空

public function handle($request, Closure $next, $guard = null,$id)
{

    $employer=Employer::find($id);
    if (Auth::guard($guard)->check())
        return redirect('/home');
      if(Auth::guard('job_seeker')->check())
      return redirect('job_seeker/profile');

      if(Auth::guard('employer')->check())
      return redirect('employer/dashboard',$employer);

    return $next($request);
}

    //web.php
    Route::get('/dashboard/{id}','Employer\Dashboard_Controller@show_dashboard')->name('employer/dashboard');


class Dashboard_Controller extends Controller
{
    public function __construct(){

        $this->middleware('auth:employer');

    }

    public function show_dashboard($id){
        // $locations=Location::all();
        // $categories=Category::all();
        $employer=Employer::find($id);
        return view('employer.dashboard',compact('employer'));
    }

}

您是否在中间件中调试了
$id
?是的,它在第171行的函数App\Http\middleware\RedirectIfAuthenticated::handle()中返回的参数太少,错误为3,传入C:\xampp\htdocs\job\u board\u App\vendor\laravel\framework\src\illighted\Pipeline\Pipeline.php,准确为4