コード例 #1
0
 protected function init($slug)
 {
     $module = WebsiteModule::where('slug', $slug)->get();
     if (!empty($module)) {
         $this->module = $module[0];
         $this->config = $this->module->config;
         $this->initialized = true;
     }
 }
コード例 #2
0
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     //cmstwo core views
     $this->loadViewsFrom(realpath(__DIR__ . '/resources/views'), 'cmstwoThemer');
     $this->website = WebsiteModule::where('slug', 'core')->get()[0];
     //cmstwo core routes
     $this->setupRoutes($this->app->router);
     //cmstwo theme helpers
     $this->setupHelpers();
 }
コード例 #3
0
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     //cmstwo core views
     $this->loadViewsFrom(realpath(__DIR__ . '/resources/views'), 'cmstwoAdmin');
     //cmstwo core routes
     $this->setupRoutes($this->app->router);
     Blade::directive('resource', function ($exp) {
         $path = substr($exp, 1, strlen($exp) - 2);
         $website = WebsiteModule::where('slug', 'core')->get()[0]->config;
         $url = $website->url . $this->resourcePath . $path;
         return "<?php echo \"" . $url . "\" ?>";
     });
 }
コード例 #4
0
 public function doSaveWebsite()
 {
     $input = Input::all();
     unset($input['_token']);
     $module = WebsiteModule::find($this->module->id);
     $conf = new \stdClass();
     foreach ($input as $k => $v) {
         $conf->{$k} = $v;
     }
     $module->config = $conf;
     $module->save();
     Artisan::call('view:clear');
     return redirect()->route('ct_admin_website');
 }
コード例 #5
0
ファイル: CmstwoController.php プロジェクト: Lab-Six/cmstwo
 private function getModuleRoutes()
 {
     $mods = WebsiteModule::all();
     $results = [];
     foreach ($mods as $module) {
         //load the core admin route
         if ($module->admin_route != '') {
             $results[$module->admin_title] = $module->admin_route;
         }
         //find any aditional routes
         $routes = json_decode($module->routes);
         if ($routes != null && key_exists("admin", $routes)) {
             $adminRoutes = $routes->admin;
             foreach ($adminRoutes as $title => $route) {
                 $results[$title] = $route;
             }
         }
     }
     return $results;
 }
コード例 #6
0
 public static function asset($exp)
 {
     $path = substr($exp, 1, strlen($exp) - 2);
     $website = WebsiteModule::where('slug', 'core')->get()[0]->config;
     $url = $website->url . 'themes/' . $website->theme . '/' . $path;
     return "<?php echo \"" . $url . "\" ?>";
 }