/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Arxmin::isInstalled()) {
         return redirect('arxmin/login');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Arxmin::isInstalled()) {
         return "You should run php artisan arxmin:install first";
     }
     return $next($request);
 }
Example #3
0
 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());
 }
Example #4
0
 /**
  * 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']);
 }
Example #5
0
 /**
  * General variables
  */
 public function __construct()
 {
     parent::__construct();
     try {
         $moduleName = \Arxmin::getCurrentModule();
         $moduleAssets = Module::asset($moduleName . ':');
         $modulePath = Module::getModulePath($moduleName);
         $module_assets = $moduleAssets;
     } catch (Exception $e) {
     }
     $this->assign(get_defined_vars());
 }
Example #6
0
 /**
  * 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');
 }
Example #7
0
 public function anyModules($action = "view")
 {
     $aModules = Arxmin::getModulesAvailables();
     if ($action == 'download') {
         $result = Module::download(Input::get('link'), Input::get('name'), \Module::getPath());
     }
     $title = trans("Modules Discovery");
     /*$oModules = Arxmin::getModules();
     
             foreach ($oModules as $module) {
     
                 $aModules[] = [
                     'title' => $module->name,
                     'description' => $module->name,
                 ];
             }*/
     return $this->viewMake('arxmin::modules.home', get_defined_vars());
 }
 /**
  * Create a new filter instance.
  *
  * @param  Guard $auth
  */
 public function __construct(Guard $auth)
 {
     $this->auth = Arxmin::getAuth();
 }
Example #9
0
 /**
  * Get Menu Structure
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getMenu()
 {
     return Response::json(Arxmin::getMenu());
 }