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


PHP Category::whereRaw方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (!Input::has('typeId')) {
         return redirect()->route('dashboard.category.index', ['typeId' => 1]);
     }
     $typeId = Input::get('typeId');
     $assign['categorys'] = $this->Category->whereRaw('parent_id = 0 and type_id = ' . $typeId)->orderByRaw('weight asc, id asc')->get();
     return view('dashboard.category.index', $assign);
 }
开发者ID:jvlstudio,项目名称:3N1WebSite,代码行数:14,代码来源:CategoryController.php

示例2: index

 public function index(Request $request)
 {
     $search = \Request::get('search');
     //<-- we use global request to get the param of URI
     if ($search) {
         $allCategory = Category::whereRaw('category_name = ?', [$search])->orderBy('id', 'asc')->paginate(5);
     } else {
         $allCategory = Category::orderBy('id', 'asc')->paginate(5);
     }
     return view('Category.index', ['Categories' => $allCategory]);
 }
开发者ID:hmakauskas,项目名称:mda,代码行数:11,代码来源:CategoryController.php

示例3: affiche

 public function affiche($id)
 {
     $title = "voiture";
     $options = $idCategries = array();
     $customers = array();
     $customer = Customer::all();
     foreach ($customer as $c) {
         $customers[$c->id] = $c->name . ' ' . $c->last_name;
     }
     if (isset($id) && !empty($id)) {
         $car = Car::findOrFail($id);
         $options = current($car->optioncars()->lists('option_id'));
         if (!empty($options)) {
             $ids = implode(",", $options);
             //option ID's
             $prices = OptionCar::whereRaw('option_id  in (' . $ids . ' ) and car_id=' . $id . ' order by option_id')->get();
             foreach ($prices as $price) {
                 $prices_car[$price->option_id]['price'] = $price->option_price;
                 $prices_car[$price->option_id]['id'] = $price->id;
             }
             $optionsList = Option::whereRaw('id  in (' . $ids . ' ) order by id')->get();
             foreach ($optionsList as $option) {
                 $el = $option->category_id;
                 if (!in_array($el, $idCategries)) {
                     //if not exist in array
                     array_push($idCategries, $el);
                 }
             }
             $idCategries = implode(",", $idCategries);
             $categories = Category::whereRaw('id  in (' . $idCategries . ')')->get();
             foreach ($categories as $cat) {
                 foreach ($optionsList as $option) {
                     if ($option['category_id'] == $cat['id']) {
                         $listcategories[$cat->id]['name'] = $cat->name_category;
                         $listcategories[$cat->id]['options'][$option->id]['name'] = $option->name;
                         $listcategories[$cat->id]['options'][$option->id]['description'] = $option->description;
                         $listcategories[$cat->id]['options'][$option->id]['price'] = $prices_car[$option->id]['price'];
                         $listcategories[$cat->id]['options'][$option->id]['id'] = $prices_car[$option->id]['id'];
                     }
                 }
             }
             return view('Cars/car-details', ['categories' => $listcategories, 'title' => $title, 'car' => $car, 'customers' => $customers]);
         } else {
             return view('Cars/car-details', ['categories' => null, 'car' => $car, 'title' => $title]);
         }
     }
 }
开发者ID:bychems,项目名称:projet-pfe,代码行数:47,代码来源:CarsController.php

示例4: getSlug

 public function getSlug($title, $allow_overlap = true)
 {
     $slug = str_slug($title);
     $slugCount = count(Category::whereRaw("slug REGEXP '^{$slug}(-[0-9]*)?\$'")->get());
     if ($allow_overlap == false) {
         return $slugCount > 0 ? false : $slug;
     } else {
         return $slugCount > 0 ? "{$slug}-{$slugCount}" : $slug;
     }
 }
开发者ID:ambarsetyawan,项目名称:laravel5-blog-1,代码行数:10,代码来源:CategoriesController.php

示例5: getCategoriesFront

 public function getCategoriesFront($id_car)
 {
     //$car=Car::where('id',$id_car)->get();
     $idCategries = array();
     $car = Car::findOrFail($id_car);
     $options = current($car->optioncars()->lists('option_id'));
     if (!empty($options)) {
         $ids = implode(",", $options);
         //option ID's
         $prices = OptionCar::whereRaw('option_id  in (' . $ids . ' ) and car_id=' . $id_car . ' order by option_id')->get();
         foreach ($prices as $price) {
             $prices_car[$price->option_id]['price'] = $price->option_price;
             $prices_car[$price->option_id]['id'] = $price->id;
         }
         $optionsList = Option::whereRaw('id  in (' . $ids . ' ) order by id')->get();
         foreach ($optionsList as $option) {
             $el = $option->category_id;
             if (!in_array($el, $idCategries)) {
                 //if not exist in array
                 array_push($idCategries, $el);
             }
         }
         $idCategries = implode(",", $idCategries);
         $categories = Category::whereRaw('id  in (' . $idCategries . ')')->get();
         foreach ($categories as $cat) {
             foreach ($optionsList as $option) {
                 if ($option['category_id'] == $cat['id']) {
                     $listcategories[$cat->id]['name'] = $cat->name_category;
                     $listcategories[$cat->id]['icone'] = $cat->icon;
                     $listcategories[$cat->id]['options'][$option->id]['name'] = $option->name;
                     $listcategories[$cat->id]['options'][$option->id]['description'] = $option->description;
                     $listcategories[$cat->id]['options'][$option->id]['price'] = $prices_car[$option->id]['price'];
                     $listcategories[$cat->id]['options'][$option->id]['id'] = $prices_car[$option->id]['id'];
                 }
             }
         }
         return $listcategories;
     }
 }
开发者ID:bychems,项目名称:projet-pfe,代码行数:39,代码来源:UsersController.php


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