本文整理汇总了PHP中app\Location::active方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::active方法的具体用法?PHP Location::active怎么用?PHP Location::active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Location
的用法示例。
在下文中一共展示了Location::active方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($slug)
{
$this->view_data['page_size'] = (int) Config::get('constants.general')['page_size'];
$this->view_data['offset'] = (int) Input::get('offset', 0);
$this->view_data['ajax'] = (bool) Input::get('ajax', false);
if ($this->view_data['offset'] < 0) {
$this->view_data['offset'] = 0;
}
$this->view_data['page_no'] = $this->view_data['offset'] + 1;
$search_query = Input::get('search_query', false);
$location = Input::get('location', false);
// var_dump($page_size, $page_no, $search_query);die;
$this->view_data['classic_ad'] = ClassicAd::findBySlug($slug);
$this->view_data['page_title'] .= ' - ' . $this->view_data['classic_ad']->title;
$this->view_data['result_count'] = $this->view_data['classic_ad']->userClassicAds()->searchLocation($location)->searchText($search_query)->orderBy('created_at', 'desc')->count();
$this->view_data['user_classic_ads'] = $this->view_data['classic_ad']->userClassicAds()->searchLocation($location)->searchText($search_query)->orderBy('created_at', 'desc')->take($this->view_data['page_size'])->skip($this->view_data['offset'] * $this->view_data['page_size'])->get();
// echo count($this->view_data['user_classic_ads']);die;
$this->view_data['heading'] = $this->view_data['classic_ad']->title;
$this->view_data['locations'] = Location::active()->orderBy('location')->lists('location', 'id');
if ($this->view_data['ajax'] == true) {
$returnHTML = view($this->view_data['view_path_root'] . '.show_partials.list', $this->view_data)->render();
return response()->json(array('status' => 200, 'html' => $returnHTML));
}
// $this->printArray($this->view_data);die;
return view($this->view_data['view_path_root'] . '.show', $this->view_data);
}