Esempio n. 1
0
 protected function toggle($siteid, $switch)
 {
     if (empty($siteid)) {
         $siteid = $this->id;
     }
     $current = app('veer')->siteId;
     if (empty($current) || $current != $siteid) {
         \Veer\Models\Site::where('id', $siteid)->update(['on_off' => $switch]);
         event('veer.message.center', trans('veeradmin.sites.' . ($switch ? 'up' : 'down'), ['site_id' => $siteid]));
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * 
  */
 protected function getConfigurationOrComponent($type = 'configuration', $siteId = null, $orderBy = array('id', 'desc'))
 {
     $orderBy = $this->replaceSortingBy($orderBy);
     if (empty($siteId)) {
         $items = \Veer\Models\Site::select();
     } else {
         $items = \Veer\Models\Site::where('id', '=', $siteId);
     }
     $items = $items->with(array($type => function ($query) use($orderBy, $type) {
         if ($type == 'components') {
             $query->orderBy('sites_id');
         }
         $query->orderBy('theme', 'asc')->orderBy($orderBy[0], $orderBy[1]);
     }))->get();
     return $items;
 }
Esempio n. 3
0
 /**
  * Check if this site's url exists in database & return its id.
  * Because of caching turning on/off and other changes
  * come to effect after cleaning cache only.
  *
  * @param string $siteUrl
  * @return \Veer\Models\Site $siteDb
  */
 protected function isSiteAvailable($siteUrl)
 {
     $this->cachingQueries->make(\Veer\Models\Site::where('url', '=', $siteUrl)->where('on_off', '=', '1'));
     $siteDb = $this->cachingQueries->rememberForever('firstOrFail');
     if ($siteDb->redirect_on == 1 && $siteDb->redirect_url != "") {
         $siteDb = (new CachingQueries(\Veer\Models\Site::where('url', '=', $siteDb->redirect_url)->where('on_off', '=', '1')))->rememberForever('firstOrFail');
     }
     return $siteDb;
 }