当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::active方法代码示例

本文整理汇总了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);
 }
开发者ID:sherazali123,项目名称:removals-laravel,代码行数:32,代码来源:ClassifiedAdController.php


注:本文中的app\Location::active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。