BadMethodCallException方法[logout]不存在

时间:2017-06-27 07:04:55

标签: javascript php laravel

web.php:

Route::get('admin/manager/logout','Admin\IndexController@logout');

ManagerController:

public function logout(Request $request)
{
    Auth::guard('admin')->logout();
    return redirect('/admin/manager/login');
}

index.blade.php:

<li>
    <a href="/admin/manager/logout" onclick="if(!confirm('Confirm exit?')){ return false }">Log out</a>
</li>

错误:

  

(1/1)BadMethodCallException方法[logout]不存在。

1 个答案:

答案 0 :(得分:0)

logout中定义的ManagerController方法,因此在路由中更改它:

Route::get('admin/manager/logout','Admin\ManagerController@logout');