示例#1
0
 public function add($data, $relation = null, $attach_id = null, $returnId = true)
 {
     $prefix = 'fl';
     $model = null;
     switch ($relation) {
         case 'products':
             $model = \Veer\Models\Product::find($attach_id);
             $prefix = 'prd';
             break;
         case 'pages':
             $model = \Veer\Models\Page::find($attach_id);
             $prefix = 'pg';
             break;
         case 'categories':
             $model = \Veer\Models\Category::find($attach_id);
             $prefix = 'ct';
             break;
         case 'users':
             $model = \Veer\Models\User::find($attach_id);
             $prefix = 'usr';
             break;
     }
     $id = $this->upload('image', 'uploadImage', $attach_id, $model, $prefix, null, is_object($model) ? false : true, $data);
     return $returnId ? $id : $this;
 }
示例#2
0
 /**
  * Change Page status - hidden or not.
  *
  * @param int $id
  * @return \Veer\Services\Administration\Elements\Page
  */
 public function toggleStatus($id)
 {
     if (empty($id)) {
         return $this;
     }
     $page = $this->entity instanceof $this->className && $this->entity->id == $id ? $this->entity : \Veer\Models\Page::find($id);
     if (is_object($page)) {
         $page->hidden = $page->hidden == true ? false : true;
         $page->save();
         event('veer.message.center', trans('veeradmin.page.status'));
     }
     return $this;
 }
示例#3
0
 public function fire($job, $data)
 {
     $ids = array_get($data, 'ids', null);
     if (empty($ids) || !is_array($ids)) {
         return $job->fail();
     }
     $notfound = true;
     foreach ($ids as $id) {
         $page = \Veer\Models\Page::find($id);
         if (is_object($page)) {
             $page->hidden = false;
             $page->save();
             $notfound = false;
         }
     }
     if ($notfound == true) {
         return $job->fail();
     }
     // leave it here
     if (isset($data['repeatJob']) && $data['repeatJob'] > 0) {
         $job->release($data['repeatJob'], 'minutes');
     }
 }
示例#4
0
 /**
  * Register Pages
  * 
  * 
  * @param string $src
  */
 protected function registerPages($src)
 {
     $this->loadedComponents['page'][$src] = \Veer\Models\Page::find($src);
 }