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


PHP Category::select方法代码示例

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


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

示例1: getEdit

 public function getEdit($id)
 {
     $category = Category::select('id', 'name', 'prarent_id')->get()->toArray();
     $product = Product::findOrFail($id);
     $product_img = Product::findOrFail($id)->pimages()->get()->toArray();
     return view('backend.product.edit', compact('category', 'product', 'product_img'));
 }
开发者ID:nguyentandat43,项目名称:booksonline,代码行数:7,代码来源:ProductContoller.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $users = User::select('id')->get();
     $products = Product::select('id')->get();
     $categories = Category::select('id')->get();
     $areas = Area::select('id')->get();
     $orders = Order::select('id')->get();
     return view('admin.dashboard', compact('users', 'products', 'categories', 'areas', 'orders'));
 }
开发者ID:axicraw,项目名称:tropara,代码行数:15,代码来源:ApanelController.php

示例3: getViewCat

    public function getViewCat($category_id)
    {
       // $posts = DB::table('posts')
       //     ->where('category_id', '=', $category_id)
        //    ->get();

        return view('category')
        ->with('title', 'Blog | Category')
        ->with('catdescription',Category::select('description')->where('id', $category_id)->first())
        ->with('posts', Post::where('category_id', '=', $category_id)->paginate(10))
        ->with('category', Category::all());
    }
开发者ID:rostiknaz,项目名称:laravelblog,代码行数:12,代码来源:HomeController.php

示例4: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $user = Auth::user();
     $user_type = $user->user_type;
     if ($user_type == 'COMPANY') {
         $id_company = $user->id_company;
     } else {
         $id_company = Session::get('id_company');
     }
     $categories = Category::select('category_name', 'id_category')->where('id_company', '=', $id_company)->get();
     $products = Product::where('id_company', '=', $id_company)->get();
     return view("pedidos.novo", compact('products', 'categories'));
 }
开发者ID:sandrovw64,项目名称:comanda-teste,代码行数:18,代码来源:OrderController.php

示例5: categoryId

 /**
  * Отображаем пагинацией все новости в конкретной категории
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function categoryId($id)
 {
     try {
         $data = \DB::table('news')->where('category_id', $id)->where('publish', '1')->orderBy('id', 'desc')->paginate(10);
         $categoryTitle = Category::select('title')->where('id', $id)->where('publish', 1)->get()[0]->title;
     } catch (\ErrorException $e) {
         abort(404);
     }
     // обрезаем 200 символов текста новости
     $this->get200Text($data);
     $this->title .= ': ' . $categoryTitle . $this->getTitlePagination();
     return view('news.list', ['title' => $this->title, 'data' => $data, 'categoryTitle' => $categoryTitle]);
 }
开发者ID:razumovsu,项目名称:jcredit-online.ru,代码行数:19,代码来源:NewController.php

示例6: categoryId

 /**
  * Отображаем пагинацией все статьи в конкретной категории
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function categoryId($id)
 {
     // почему-то не работает upd:заработало. спасибо stackoverflow!
     //$data = Category::find($id)->articles()->where('publish', '1')->paginate(5);
     try {
         $data = \DB::table('info')->where('category_id', $id)->where('publish', '1')->where('published_at', '<=', Carbon::now())->orderBy('id', 'desc')->select('title', 'url')->paginate(10);
         $categoryTitle = Category::select('title')->where('id', $id)->where('publish', 1)->get()[0]->title;
     } catch (\ErrorException $e) {
         abort(404);
     }
     $this->title .= $categoryTitle . $this->getTitlePagination();
     return view('articles.list', ['title' => $this->title, 'data' => $data, 'categoryTitle' => $categoryTitle]);
 }
开发者ID:razumovsu,项目名称:jcredit-online.ru,代码行数:19,代码来源:ArticleController.php

示例7: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $table = "company";
     if (\Schema::hasTable($table)) {
         $main_company = Company::find(1)->toArray();
         $categories_menu = \Cache::remember('categories_mothers', 25, function () {
             return Category::select('id', 'name')->childsOf('mothers')->actives()->get()->toArray();
         });
         $menu = [];
         foreach ($categories_menu as $value) {
             $menu[$value['id']] = $value;
         }
         \View::share('main_company', $main_company);
         \View::share('categories_menu', $menu);
     }
 }
开发者ID:rolka,项目名称:antVel,代码行数:21,代码来源:AppServiceProvider.php

示例8: getall

 public function getall()
 {
     $categories = Category::select('id', 'cat_name', 'img_url', 'cat_position')->get();
     return Response::json($categories);
 }
开发者ID:Quiz-app,项目名称:Knowledge,代码行数:5,代码来源:CategoriesController.php

示例9: getCategoryOptions

 /**
  * @param Category $except
  *
  * @return CategoriesController
  */
 protected function getCategoryOptions($except = null)
 {
     /** @var \Kalnoy\Nestedset\QueryBuilder $query */
     $query = Category::select('id', 'name')->withDepth();
     if ($except) {
         $query->whereNotDescendantOf($except)->where('id', '<>', $except->id);
     }
     return $this->makeOptions($query->get());
 }
开发者ID:matheusgomes17,项目名称:farejaofertas,代码行数:14,代码来源:AdminCategoryController.php

示例10: getRandId

 public static function getRandId()
 {
     $category = Category::select(['id'])->orderByRaw('RAND()')->take(1)->first();
     return $category->id;
 }
开发者ID:softsolution,项目名称:antVel,代码行数:5,代码来源:CategoriesController.php

示例11: getCategoryOptions

 /**
  * @param Category $except
  *
  * @return CategoriesController
  */
 protected function getCategoryOptions($except = null)
 {
     $query = Category::select('id', 'name')->withDepth();
     if ($except) {
         $query->whereNotDescendantOf($except)->where('id', '<>', $except->id);
     }
     return $this->makeOptions($query->get());
 }
开发者ID:matheusgomes17,项目名称:farejaofertas,代码行数:13,代码来源:AdminProductController.php

示例12: propertyCategories

 public function propertyCategories()
 {
     $search = \Input::get('q');
     if ($search) {
         $categories = \App\Category::select('Categories.*')->join('CategoryLanguages', 'CategoryLanguages.property_id', '=', 'Categories.id')->where('CategoryLanguages.locale', $this->lang)->where('CategoryLanguages.title', 'like', $search . '%')->orderBy('Categories.created_at', 'desc')->paginate($this->limit);
     } else {
         $categories = \App\Category::orderBy('order', 'asc')->paginate($this->limit);
     }
     return view('admin.pages.categories', compact('categories'));
 }
开发者ID:candrasetiadi,项目名称:nvjvnjsdnnvdvdw,代码行数:10,代码来源:AdminController.php

示例13: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($slug)
 {
     return view('admin.articles.edit', ['article' => Article::with('tags', 'category')->where('slug', $slug)->firstOrFail(), 'categories' => Category::select('id', 'name')->get(), 'tags' => Tag::select('id', 'name')->get()]);
 }
开发者ID:angelWendy,项目名称:streamlet,代码行数:10,代码来源:ArticlesController.php

示例14: getEdit

 public function getEdit($id)
 {
     $data = Category::findOrFail($id)->toArray();
     $parent = Category::select('id', 'name', 'prarent_id')->get()->toArray();
     return view('backend.category.edit', compact('parent', 'data'));
 }
开发者ID:nguyentandat43,项目名称:booksonline,代码行数:6,代码来源:CategoryController.php

示例15: parentsTree

 /**
  * parentsTree
  * Retrieve all the categories parents of one passed through parameter,
  * checking data from bottom to top
  * @param [int] $id is the id category evaluated
  * @param [array] $array is the array to be used out of the model
  * @param [array] $fields is the array that contais the table field we want to retrieve
  */
 public static function parentsTree($id, &$array, $fields = ['id', 'category_id', 'name'])
 {
     $categories = Category::select($fields)->where('id', $id)->get()->toArray();
     if (is_null($categories)) {
         return;
     }
     foreach ($categories as $value) {
         $array[] = $value;
         Category::parentsTree($value['category_id'], $array, $fields);
     }
     return;
 }
开发者ID:masterpowers,项目名称:antVel,代码行数:20,代码来源:Category.php


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