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; } }
/** * 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(); }
/** * 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 . "\" ?>"; }); }
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'); }
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; }
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 . "\" ?>"; }