public function masonry($view = null) { $view = $view ? $view : 'list-masonry'; $items = null; $list = array(); $class = '\\' . ucfirst($this->model); $param = array_intersect_key(Input::all(), array_flip($this->requestParam)); if ($param) { foreach ($param as $key => $value) { if (empty($items)) { $items = $class::where($key, $value); } else { $items->where($key, $value); } } if ($param['module'] === 'site') { $site = App\Models\Site::find($param['module_id']); $list = $items->getDefault($site); } else { $list = Input::get('limit') ? $items->paginate(Input::get('limit')) : $items->get(); } } $listShow = (string) view($this->model . '.items.' . $view, array('list' => $list)); return $listShow; }
public function getSettings() { if (is_object($this->imageable)) { $settings = $this->imageable->getSettings(); if (empty($settings['image'])) { $mainPageSettings = App\Models\Site::find(1)->getSettings(); $settings['image'] = $mainPageSettings['image']; } return $settings; } return array(); }
<li class="active"> <a href="#site" data-toggle="tab">Страница</a> </li> <li> <a href="#url" data-toggle="tab">Внешняя ссылка</a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane fade in active" id="site"> <div class="form-group"> <select name="element_id" class="form-control"> <option value="0">---</option> <?php foreach (App\Models\Site::all() as $site) { ?> <option value="<?php echo $site->id; ?> "><?php echo $site->name; ?> </option> <?php } ?> </select> </div> <div class="form-group"> <input type="hidden" name="autopath" value="0" />
public function getSettings($param = null) { $site = App\Models\Site::path('profile', true, false); $return = empty($site) ? App\Models\Site::find(1)->settings : $site->settings; // costl if (empty($return['image'])) { $mainPageSettings = App\Models\Site::find(1)->getSettings(); $return['image'] = $mainPageSettings['image']; } if (!empty($param)) { $tmp = explode('.', $param); $subSettings = $return; foreach ($tmp as $val) { if (isset($subSettings[$val])) { $subSettings = $subSettings[$val]; } else { return null; } } return $subSettings; } return $return; }
<?php if ($site->id == 1) { echo $site->title(); } else { $root = App\Models\Site::find(1)->name; // $items = array(); // // foreach ($site->breadCrumbs() as $k => $item) { // // if (!$k) continue; // // $items[] = $item['title'] ? $item['title'] : $item['name']; // // } $title = $site->title(); // $title .= $items ? ' - '.implode(' - ', array_reverse($items)) : ''; $title .= $root ? ' - ' . $root : ''; echo $title; }