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


PHP Product::search方法代码示例

本文整理汇总了PHP中app\Product::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::search方法的具体用法?PHP Product::search怎么用?PHP Product::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Product的用法示例。


在下文中一共展示了Product::search方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $product = Product::find($id);
     // Find similar products, limit to 3 results
     $simProducts = Product::search('Any', $product->name)->take(3)->get();
     return view('products.show', ['product' => $product, 'simProducts' => $simProducts]);
 }
开发者ID:brandonhuang,项目名称:globely,代码行数:13,代码来源:ProductsController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $term = $request->input('query');
     $prop = $request->input('prop');
     if (isset($term)) {
         $products = Product::search($prop, $term)->get();
     } else {
         $products = Product::all();
     }
     // Pass in articles data to view
     return view('products.index', ['products' => $products, 'query' => $term, 'prop' => $prop]);
 }
开发者ID:jclancy93,项目名称:globely,代码行数:17,代码来源:ProductsController.php

示例3: search

 public function search(Request $request)
 {
     $validator = Validator::make($request->all(), ['maxPrice' => 'required|integer', 'minPrice' => 'required|integer']);
     if ($validator->fails()) {
         return view('search.results')->withErrors($validator);
     }
     $type = $request->input('clothes');
     $size = $request->input('size');
     $maxPrice = $request->input('maxPrice');
     $minPrice = $request->input('minPrice');
     $colors = $request->input('colors');
     $result = Product::search($type, $size, $maxPrice, $minPrice, $colors);
     $arBag = self::getBag();
     $arHeartbag = self::getHeartBag();
     return view('search.results')->withResults($result)->withBag($arBag)->withHeartbag($arHeartbag);
 }
开发者ID:rubenwouters,项目名称:Hello-Maternity,代码行数:16,代码来源:SearchController.php

示例4: show

 public function show(Request $request)
 {
     if (!$request->has('q')) {
         return redirect('/' . LANG);
     }
     $params = $request->only('q');
     $searchParams = explode(" ", trim($params['q']));
     $productsResults = Product::search($searchParams);
     $portfoliosResults = Portfolio::search($searchParams);
     $newsResults = News::search($searchParams);
     $tendersResults = Tender::search($searchParams);
     $vacanciesResults = Vacancy::search($searchParams);
     $sharesResults = Share::search($searchParams);
     $experEdvicesResults = ExpertAdvice::search($searchParams);
     $count = count($productsResults) + count($portfoliosResults) + count($newsResults) + count($tendersResults) + count($vacanciesResults) + count($sharesResults) + count($experEdvicesResults);
     return view('search', ['products' => $productsResults, 'portfolios' => $portfoliosResults, 'news' => $newsResults, 'tenders' => $tendersResults, 'vacancies' => $vacanciesResults, 'shares' => $sharesResults, 'experEdvices' => $experEdvicesResults, 'count' => $count, 'title' => LANG . '_title', 'description' => LANG . '_description', 'adderss' => LANG . '_adderss', 'type' => 'news']);
 }
开发者ID:NickMomchev,项目名称:bautech,代码行数:17,代码来源:SearchController.php

示例5: function

|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::group(['prefix' => 'products'], function () {
    Route::get('main', ['as' => 'search', function () {
        $categories = \DB::table('aux_categories')->lists('description', 'id');
        $query = \Illuminate\Support\Facades\Input::get('search');
        // Check if user has sent a search query
        if ($query) {
            $products = \App\Product::search($query);
        } else {
            // Show all posts if no query is set
            $products = \App\Product::all();
        }
        return view('products.main', ['products' => $products, 'categories' => $categories]);
    }]);
    Route::get('showDetails/{n}', function ($product_id) {
        return \App\Product::find($product_id);
    });
});
Route::group(['middleware' => ['web']], function () {
    Route::get('orders/index', array('uses' => 'OrdersController@index'));
    Route::get('orders/addToCart', array('uses' => 'OrdersController@addToCart'));
    Route::get('orders/removeFromCart', array('uses' => 'OrdersController@removeFromCart'));
    Route::get('orders/clearCart', array('uses' => 'OrdersController@clearCart'));
开发者ID:luizpcam,项目名称:cartSimulation,代码行数:31,代码来源:routes.php

示例6: searchProductsURL

 /**
  * Search products by url
  *
  * @param $keyword
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function searchProductsURL($keyword)
 {
     $products = Product::search($keyword)->paginate(35);
     return view('manage.product.index', compact('products', 'keyword'));
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:11,代码来源:ManageController.php

示例7: searchProducts

 /**
  * Search products
  *
  * @param $keyword
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function searchProducts($keyword)
 {
     $products = Product::search($keyword)->paginate(35);
     return view('products.search', compact('keyword', 'products'));
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:11,代码来源:HomeController.php

示例8: fastSearch

 public function fastSearch(Request $request)
 {
     $this->validate($request, ['query' => 'required|min:3', 'section' => 'required|in:users,products']);
     if ($request->input('section') == 'users') {
         $query = User::search($request->input('query'), null, true);
         $query->leftJoin('profits', 'users.id', '=', 'profits.user_id');
         $query = $query->select(DB::raw("IF(profits.created_at>'" . Carbon::now()->subWeek() . "','yes','no') AS test,IFNULL(`profits`.`type`,0) AS type,(SELECT relevance)*(case when type=1 AND (SELECT test)='yes' then  '" . Config::get('addonProfit.attributes')[1]['values'][1]['weight'] . "' when type=2 AND (SELECT test)='yes' then '" . Config::get('addonProfit.attributes')[1]['values'][2]['weight'] . "' when type=3 AND (SELECT test)='yes' then '" . Config::get('addonProfit.attributes')[1]['values'][3]['weight'] . "' else 1 end) AS total_relevance"))->addSelect('users.*')->groupBy('users.id')->orderBy('total_relevance', 'DESC');
         $results = $query->get();
     } elseif ($request->input('section') == 'products') {
         $query = Product::search($request->input('query'), null, true);
         $results = $query->groupBy('products.id')->get();
     }
     $return = view('search.partials.fastResult', compact('results'))->with(['section' => $request->input('section')])->render();
     return ['hasCallback' => 1, 'callback' => 'search_fast', 'hasMsg' => 0, 'msg' => '', 'msgType' => '', 'returns' => $return];
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:15,代码来源:SearchController.php

示例9: search

 public function search()
 {
     $key = $_GET['keyword'];
     $data = Product::search($key);
     $nav = new category();
     $menu_top = $nav->menu_top($nav->all()->toArray());
     return view('frontend.pages.search', array('data' => $data, 'menu_top' => $menu_top));
 }
开发者ID:nhunght,项目名称:mork_SmartOSC,代码行数:8,代码来源:frontendController.php

示例10: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $user = User::find($id);
     $products = Product::search('Supplier', $user->company_name)->get();
     return view('users.show', ['user' => $user, 'products' => $products]);
 }
开发者ID:brandonhuang,项目名称:globely,代码行数:12,代码来源:UsersController.php

示例11: results

 public function results(Request $request)
 {
     $query = $request->input('for');
     $results = Product::search($query)->get();
     return view('searchs.results', compact('results', 'query'));
 }
开发者ID:maherelgamil,项目名称:ketabat,代码行数:6,代码来源:SearchsController.php


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