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


PHP Product::join方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(GamesRequest $request)
 {
     $games = Product::join('games as g', 'g.product_id', '=', 'id');
     $games = $games->where('type', 'GAME');
     $title = 'Game';
     $heading = 'Game';
     // platform
     if (!empty($request->platform)) {
         $games = $games->where('g.platform_id', Platform::where('name', $request->platform)->first()->id);
         $heading = $request->platform . ' ' . $heading + 's';
     }
     // query
     if (!empty($request->q)) {
         $games = $games->where('name', 'LIKE', '%' . $request->q . '%');
     }
     // sort
     if (!empty($request->sort)) {
         $games = $games->orderBy($request->sort, $request->order);
     } else {
         $games = $games->orderBy('g.updated_at', 'desc');
     }
     // flash input
     $request->flash();
     return view('games.index')->with('title', $title)->with('heading', $heading)->with('games', $games->paginate(env('PAGINATE')));
 }
开发者ID:noorxbyte,项目名称:vultex,代码行数:30,代码来源:GamesController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($type, VideosRequest $request)
 {
     $videos = Product::join('videos as v', 'v.product_id', '=', 'id');
     switch ($type) {
         case "movies":
             $videos = $videos->where('type', 'MOVIE');
             $title = 'Movies';
             $heading = 'Movies';
             break;
         case "series":
             $videos = $videos->where('type', 'SERIES');
             $title = 'Series';
             $heading = 'Series';
             break;
         case "anime":
             $videos = $videos->where('type', 'ANIME');
             $title = 'Anime';
             $heading = 'Anime';
             break;
         case "documentries":
             $videos = $videos->where('type', 'VIDEO');
             $title = 'Documentries';
             $heading = 'Documentries';
             break;
         default:
             return redirect()->back();
     }
     // language
     if (!empty($request->language)) {
         $videos = $videos->where('v.language_id', Language::where('name', $request->language)->first()->id);
         $heading = $request->language . ' ' . $heading;
     }
     // query
     if (!empty($request->q)) {
         $videos = $videos->where('name', 'LIKE', '%' . $request->q . '%');
     }
     // sort
     if (!empty($request->sort)) {
         $videos = $videos->orderBy($request->sort, $request->order);
     } else {
         $videos = $videos->orderBy('v.release_date', 'desc');
     }
     // flash input
     $request->flash();
     return view('videos.index')->with('title', $title)->with('heading', $heading)->with('videos', $videos->paginate(env('PAGINATE')))->with('type', $type);
 }
开发者ID:noorxbyte,项目名称:vultex,代码行数:51,代码来源:VideosController.php

示例3: products

 public function products()
 {
     return Product::join('locations', 'locations.product_id', '=', 'products.id')->where('locations.user_id', $this->getKey());
 }
开发者ID:MetropoliaUAS,项目名称:ISDProject-Online,代码行数:4,代码来源:User.php

示例4: function

});
Route::group(['prefix' => 'settings', 'namespace' => 'Settings\\Uoms', 'middleware' => ['auth', 'is_admin']], function () {
    Route::resource('uoms', 'UomsController');
});
Route::resource('paymentMethods', 'PaymentMethods\\PaymentMethodsController', ['middleware' => 'auth', 'is_user', 'is_admin']);
Route::resource('paramPacs', 'ParamPacs\\ParamPacsController', ['middleware' => ['auth', 'is_user', 'is_admin']]);
Route::resource('partners', 'Partners\\PartnersController', ['middleware' => ['auth', 'is_user', 'is_admin']]);
Route::resource('taxs', 'Taxs\\TaxsController', ['middleware' => ['auth', 'is_user', 'is_admin']]);
Route::group(['prefix' => 'settings', 'namespace' => 'Settings\\Certificatesats', 'middleware' => ['auth', 'is_admin']], function () {
    Route::resource('certificatesats', 'CertificatesatsController');
});
Route::group(['namespace' => 'Products', 'middleware' => ['auth', 'is_admin', 'is_user', 'is_sale']], function () {
    Route::pattern('products', '[0-9]+');
    Route::get('products/searchCode/{ean13}', ['as' => 'products.searchCode', function ($ean13) {
        if (Request::ajax()) {
            $producto = Product::join('uoms', 'products.uom_id', '=', 'uoms.id')->where('ean13', $ean13)->select('products.*', 'uoms.name as umo_name')->get();
            return $producto->toJson();
        }
    }]);
    Route::get('products/report', 'ProductsController@report');
    Route::get('products/reportmax', 'ProductsController@reportmax');
    Route::get('products/reportmin', 'ProductsController@reportmin');
    Route::resource('products', 'ProductsController');
});
Route::group(['namespace' => 'SaleOrders', 'middleware' => ['auth', 'is_admin', 'is_user', 'is_sale']], function () {
    Route::pattern('sales', '[0-9]+');
    Route::resource('sales', 'SaleOrdersController');
});
Route::group(['namespace' => 'PurchaseOrders', 'middleware' => ['auth', 'is_admin', 'is_user', 'is_purchase']], function () {
    Route::pattern('purchases', '[0-9]+');
    Route::resource('purchases', 'PurchaseOrdersController');
开发者ID:raulbravo23,项目名称:salepoint,代码行数:31,代码来源:routes.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $product = new Product();
     Product::find($id)->delete();
     $products = $product->join('categories', 'products.category_id', '=', 'categories.id')->select('products.title', 'products.description', 'products.cost_price', 'products.id', 'categories.name')->orderBy('products.title', asc)->get();
     $category = new Category();
     $categories = $category->orderBy('name', asc)->get();
     return view('dashboard/products')->with('products', $products)->with('categories', $categories)->with('deleted', 1);
 }
开发者ID:poudigne,项目名称:lcdj,代码行数:15,代码来源:ProductController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int $productId
  * @param Requests\ShowingSamplingsRequest $request
  * @return \Illuminate\Http\Response
  */
 public function show($productId, ShowingSamplingsRequest $request)
 {
     $product = Product::join('locations', 'locations.product_id', '=', 'products.id')->where('locations.user_id', $this->guard->user()->getKey())->findOrFail($productId);
     // Just to throw a failure if the product is not found
     $samplingsQueryBuilder = Sampling::query();
     $samplingsQueryBuilder->join('sensors', 'samplings.sensor_id', '=', 'sensors.id');
     $samplingsQueryBuilder->join('generic_sensors', 'sensors.generic_sensor_id', '=', 'generic_sensors.id');
     $samplingsQueryBuilder->join('products', 'sensors.product_id', '=', 'products.id');
     $samplingsQueryBuilder->where('products.id', $productId);
     $samplingsQueryBuilder->orderBy('samplings.created_at', 'desc');
     $limit = $request->has('limit') && $request->limit < 1000 ? $request->limit : 1000;
     if ($request->generic_sensor_id) {
         $samplingsQueryBuilder->where('generic_sensors.id', $request->generic_sensor_id);
     }
     $timeFiltersApplied = $this->filterResultsInTime($samplingsQueryBuilder, $request, $product);
     if (!$timeFiltersApplied) {
         $samplingsQueryBuilder->whereDate('samplings.created_at', '=', Carbon::today()->toDateString());
     }
     $samplingsQueryBuilder->take($limit);
     //        if ($timeFiltersApplied && array_has(["week", "month", "year"], $request->timeFilter)) {
     //            return $samplingsQueryBuilder->selectRaw("
     //                samplings.sensor_id,
     //                max(samplings.sampled),
     //                generic_sensors.id as generic_sensor_id,
     //                min(samplings.created_at)
     //            ");
     //        }
     return $samplingsQueryBuilder->get(array('samplings.id', 'samplings.sensor_id', 'generic_sensors.id as generic_sensor_id', 'samplings.sampled', 'samplings.created_at'));
 }
开发者ID:MetropoliaUAS,项目名称:ISDProject-Online,代码行数:36,代码来源:SamplingsController.php


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