public function __construct() { global $isAuth, $user; # Check if parent is callable if (is_callable('parent::__construct')) { parent::__construct(); } $auth = Arxmin::getAuth(); $isAuth = $auth->check(); $user = $auth->getUser(); $menu = Arxmin::getMenu(); // Apply_filters $eventMenu = event(new InitMenuEvent($menu, $user)); if ($eventMenu) { $menu = array_pop($menu); } $widgets = Arxmin::getWidgets(); $theme_url = Arxmin::getAssetsUrl(); # Add Arxmin hook $this->assign(get_defined_vars()); /** * Default Javascript variables */ \Hook::put('__app.debug', \Config::get('app.debug') ? 1 : 0); \Hook::put('__app.theme_url', $theme_url); \Hook::put('__app.base_url', url('/')); \Hook::put('__app.api_url', Arxmin::getApiUrl()); }
/** * Handle a login request to the application. * * @param \Illuminate\Http\Request|Request $request * @return Response */ public function postLogin(LoginRequest $request) { global $auth; # Check if user is in the DB $auth = $this->auth->attempt($request->only(['email', 'password']), $request->get('remember')); # Redirect to the first element of the dynamic arx menu $menu = Arxmin::getMenu(); return redirect($menu[0]['link']); }
/** * Return to the first link of the dynamic menu */ public function anyIndex() { global $arxminUser, $arxminAuth; try { $arxminAuth = Arxmin::getAuth()->check(); if ($arxminAuth) { $menu = Arxmin::getMenu(); return redirect($menu[0]['link']); } } catch (Exception $e) { Log::error($e); } return redirect('arxmin/login'); }
/** * Get Menu Structure * * @return \Illuminate\Http\JsonResponse */ public function getMenu() { return Response::json(Arxmin::getMenu()); }