Exemplo n.º 1
0
 public function missingMethod($args = null)
 {
     if (!$args) {
         return;
         // parent::missingMethod($args);
     }
     $modelClass = \Devhook::getClassByKey($args[0]);
     $this->model = new $modelClass();
     $action = ucfirst(isset($args[1]) ? $args[1] : 'List');
     $methodAction = strtolower($_SERVER['REQUEST_METHOD']) . $action;
     $anyAction = 'any' . $action;
     $args = array_splice($args, 2);
     $modelActions = $this->model->getModelActions();
     $this->link = $modelActions['list']['link'];
     \AdminUI::menu('navbar')->active('data');
     foreach ($modelActions as $key => $act) {
         $menuItem = \AdminUI::menu('actions')->add($act['link'], $act['title']);
         if (!empty($act['icon'])) {
             $menuItem->icon($act['icon']);
         }
     }
     return call_user_func_array(array($this, $methodAction), $args);
     if (method_exists($this, $methodAction)) {
         return call_user_func_array(array($this, $methodAction), $args);
     } elseif (method_exists($this, $anyAction)) {
         return call_user_func_array(array($this, $anyAction), $args);
     }
     return parent::missingMethod($args);
 }
Exemplo n.º 2
0
 public function register()
 {
     $this->app['devhook'] = $this->app->share(function ($app) {
         return Devhook::get_instance();
     });
     $this->app['adminUI'] = $this->app->share(function ($app) {
         return AdminUI::get_instance();
     });
 }