Ejemplo n.º 1
0
*/
Route::filter('guest', function () {
    if (UserAuthController::isLogin()) {
        return Redirect::to('/');
    }
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
Route::filter('privilege_edit', function ($route, $request, $menu_id) {
    if (false == MainFrameController::validateMenuRight($menu_id, 'edit')) {
        return Response::json(array('status' => 0, 'msg' => '无编辑权限'));
    }
});
Route::filter('privilege_view', function ($route, $request, $menu_id) {
    if (false == MainFrameController::validateMenuRight($menu_id, 'view')) {
        return '<h3>无查看权限</h3>';
    }
});
Ejemplo n.º 2
0
 public function compose($view)
 {
     $menus = MainFrameController::getSubMenus(MainFrameController::ROOT_MENU_ID);
     $view->with('menus', $menus);
 }