Esempio n. 1
0
 public static function create(array $data = [])
 {
     if (is_module_enabled('Site')) {
         $siteId = Site::id();
         $data['site_id'] = $siteId;
     }
     return parent::create($data);
 }
Esempio n. 2
0
 private function getLocale()
 {
     if (app()->runningInConsole()) {
         return null;
     }
     $host = \Site::host(true);
     $cacheKey = 'site_locale_' . $host;
     $locale = Cache::get($cacheKey);
     if (empty($locale)) {
         $siteLocale = \App\Models\SiteLocale::where('url', 'LIKE', '%' . $host)->first();
         if (empty($siteLocale)) {
             $error = 'No SiteLocale defined on the database level for host ' . $host;
             throw new \Exception($error);
         }
         $locale = $siteLocale->locale;
     }
     $expiresAt = Carbon::now()->addMinutes(10);
     Cache::put($cacheKey, $locale, $expiresAt);
     return $locale;
 }
Esempio n. 3
0
 /**
  * Register the active menus
  */
 private function registerMenus()
 {
     if (!$this->app['asgard.isInstalled']) {
         return;
     }
     if (array_key_exists('Site', app('modules')->enabled())) {
         Site::setLocale();
     }
     $menu = $this->app->make('Modules\\Menu\\Repositories\\MenuRepository');
     $menuItem = $this->app->make('Modules\\Menu\\Repositories\\MenuItemRepository');
     foreach ($menu->allOnline() as $menu) {
         $menuTree = $menuItem->getTreeForMenu($menu->id);
         MenuFacade::create($menu->name, function (Builder $menu) use($menuTree) {
             foreach ($menuTree as $menuItem) {
                 $this->addItemToMenu($menuItem, $menu);
             }
         });
     }
 }
Esempio n. 4
0
        <![endif]-->
</head>
<body class="{{ config('asgard.core.core.skin', 'skin-blue') }}" style="padding-bottom: 0 !important;">
<div class="wrapper">
    <header class="main-header">
        <a href="{{ URL::route('dashboard.index') }}" class="logo">
            <?php 
if (isset($sitename)) {
    ?>
            {{ $sitename }}
            <?php 
}
?>

            <?php 
if (is_module_enabled('Site') && isset(\Modules\Site\Facades\Site::currentLocale()->title)) {
    ?>
            {{ \Modules\Site\Facades\Site::currentLocale()->title }}
            <?php 
}
?>
        </a>
        @include('partials.top-nav')
    </header>
    @include('partials.sidebar-nav')

    <aside class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            @yield('content-header')
        </section>
Esempio n. 5
0
 /**
  * Create all thumbnails for the given image path
  * @param string $path
  */
 public function createAll($path)
 {
     if (!$this->isImage($path)) {
         return;
     }
     foreach ($this->manager->all() as $thumbnail) {
         $image = $this->image->make($this->filesystem->disk($this->getConfiguredFilesystem())->get($this->getDestinationPath($path->getRelativeUrl())));
         if (is_module_enabled('Site')) {
             $filename = config('asgard.media.config.files-path') . Site::current()->slug . '/' . $this->newFilename($path, $thumbnail->name());
         } else {
             $filename = config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail->name());
         }
         foreach ($thumbnail->filters() as $manipulation => $options) {
             $image = $this->imageFactory->make($manipulation)->handle($image, $options);
         }
         $image = $image->stream(pathinfo($path, PATHINFO_EXTENSION));
         $this->writeImage($filename, $image);
     }
 }