當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。