/**
  * @param array $otherDataToMerge
  * @param bool $addToCommon
  * @return mixed
  */
 public function getCommonVars($otherDataToMerge = array(), $addToCommon = false)
 {
     $data = Arr::merge($this->data, $otherDataToMerge);
     if ($addToCommon) {
         $this->data = $data;
     }
     # Put vars in javascript
     Hook::put('__app', $this->data);
     return $data;
 }
Beispiel #2
0
 /**
  * Register a new menu link
  * @param $data
  * @param array $params
  * @param string $ref
  * @return array
  * @throws \Exception
  */
 public static function registerMenu($data = ['name' => null, 'link' => null, 'type' => 'module', 'ico' => 'fa-pencil'], $params = ['position' => null], $ref = 'arxmin::menu')
 {
     $params = Arr::mergeWithDefaultParams($params);
     $menu = Hook::get($ref);
     if ($params['position'] !== null) {
         Arr::insert($menu, [$data], $params['position']);
     } else {
         $menu[] = $data;
     }
     Hook::set($ref, $menu);
     return Hook::get($ref);
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     /**
      * Add usefull helpers on register
      */
     include_once __DIR__ . '/helpers.php';
     /**
      * Register Arxmin with current app setting
      *
      */
     $this->app->bind('arxmin', function ($app) {
         return new Arxmin($app);
     });
     /**
      * Register common arxmin hooks
      */
     Hook::register('arxmin::css');
     Hook::register('arxmin::js');
     Hook::register('arxmin::menu');
     Hook::register('arxmin::rightbar');
     Hook::register('arxmin::widgets');
     Hook::register('arxmin::api.modules');
     $this->registerCommands();
     $this->registerProviders();
     $this->registerFacades();
 }
Beispiel #4
0
 public function testHook()
 {
     Hook::register('test');
     Hook::add('test', 'test');
     $this->assertNotNull(Hook::get('test'), 'Hook is null !');
 }