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


PHP Tag::select方法代码示例

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


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

示例1: show

 public function show($tag)
 {
     $rs = Tag::where('tag', $tag)->get();
     $arr = array();
     foreach ($rs as $v) {
         array_push($arr, $v->article_id);
     }
     $articles = Article::whereIn('id', $arr)->get();
     $tags = Tag::select('tag')->distinct()->get();
     return view('member.tags.show', compact('tag', 'tags', 'articles'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:11,代码来源:TagsController.php

示例2: index

 public function index(Request $request)
 {
     $page = $request->get('page') ?: 1;
     $tags = Tag::select('tag')->distinct()->get();
     $articles = Article::latest()->where('published_at', '<=', Carbon::now())->skip(($page - 1) * self::PAGE_SIZE)->limit(10)->get();
     $total = Article::latest()->where('published_at', '<=', Carbon::now())->get()->count();
     $cates = Cate::all();
     $teams = Team::where('user_id', \Auth::user()->id)->get();
     $action = 'articles';
     $pageData['totalPage'] = ceil($total / self::PAGE_SIZE);
     $pageData['currentPage'] = $page;
     return view('member.articles.index', compact('articles', 'tags', 'cates', 'teams', 'articles', 'pageData'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:13,代码来源:ArticlesController.php

示例3: index

 /**
  * Display the home page.
  */
 public function index()
 {
     $carousel_news = Article::select('id', 'title', 'page_image')->where('is_checked', true)->where('is_carousel', true)->published()->get();
     $latest_news = Article::select('id', 'title', 'intro', 'page_image')->where('is_checked', true)->published()->orderBy('published_at', 'desc')->take(4)->get();
     $ads = Ad::select('url', 'name', 'image_path')->orderBy('created_at', 'desc')->take(2)->get();
     // get the index article
     $tags = Tag::select('id', 'name')->where('show_index', true)->get();
     $index_articles = array();
     foreach ($tags as $tag) {
         $tag['articles'] = $tag->articles()->select('article_id', 'title', 'intro', 'page_image')->where('is_checked', true)->published()->orderBy('published_at', 'desc')->take(3)->get();
         $index_articles[] = $tag;
     }
     return view('front.index')->with('carousel_news', $carousel_news)->with('latest_news', $latest_news)->with('ads', $ads)->with('index_articles', $index_articles);
 }
开发者ID:smile-zhao,项目名称:Laravel5.1_Example,代码行数:17,代码来源:UserController.php

示例4: show

 public function show($id)
 {
     $user = User::findOrFail($id);
     $tags = Tag::select('tag')->distinct()->where('user_id', $id)->get();
     $articles = Article::where('user_id', $id)->orderby('published_at', 'desc')->get();
     //博主访客加1
     if (\Auth::user()->id != $id) {
         $r = FlowTrace::where(['user_id' => $id, 'time' => substr(Carbon::now(), 0, 10)])->first();
         if ($r) {
             $r->increment('daycount');
         } else {
             FlowTrace::create(array('user_id' => $id, 'time' => substr(Carbon::now(), 0, 10), 'daycount' => 1));
         }
         User::where('id', $id)->increment('score');
     }
     return view("member.users.show", compact('user', 'tags', 'articles'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:17,代码来源:UsersController.php

示例5: getAllwithPosts

 public function getAllwithPosts()
 {
     return Tag::select('id', 'title')->with(['posts' => function ($q) {
         $q->select('id', 'title')->active();
     }])->get();
 }
开发者ID:LucasFCastro,项目名称:laravel_and_angularjs_codes,代码行数:6,代码来源:TagController.php

示例6: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('front.nav', function ($view) {
         view()->share('tags', Tag::select('id', 'name')->orderBy('id', 'asc')->get());
     });
 }
开发者ID:smile-zhao,项目名称:Laravel5.1_Example,代码行数:11,代码来源:AppServiceProvider.php

示例7: 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

示例8: getCondations

 /**
  * 获取不同筛选条件中的值
  * @method getCondations
  * @return [type]        [description]
  */
 public function getCondations()
 {
     $data['instrument'] = Instrument::select('id', 'name')->get();
     $data['press'] = \App\Press::select('id', 'name')->get();
     $data['tag'] = \App\Tag::select('id', 'name')->get();
     // $data['operator'] = \App\User::select('id', 'name')->with('musics')->whereHas('musics', function ($query) {
     //                                                         $query->groupby('operator');
     //                                                     })->groupby('id')->get();
     $data['operator'] = \App\User::select('id', 'name')->whereHas('musics', function ($query) {
         $query->groupby('operator');
     })->groupby('id')->get();
     $data['organizer'] = \App\Organizer::select('id', 'name')->get();
     return $data;
     // $data['status'] = 'sdfsdfsdfsdfsdfsdfsdfdsf';
     // return $data;
 }
开发者ID:WangWeigao,项目名称:m1,代码行数:21,代码来源:MusicController.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $product = $this->productRepository->findById($id);
     if (auth()->user()->id != $product->user_id) {
         return redirect()->home();
     }
     $categories_list = $this->categoryRepository->getParentsAndChildrenList(true);
     //Category::lists('name', 'id')->all();
     $tags_list = Tag::select('name', 'price', 'id')->get();
     $options_list = Option::select('name', 'description', 'price', 'id')->get();
     $selected_categories = $product->categories()->select('categories.id AS id')->lists('id')->all();
     $selected_tags = $product->tags()->select('tags.id AS id')->lists('id')->all();
     return view('products.edit')->with(compact('product', 'categories_list', 'tags_list', 'options_list', 'selected_categories', 'selected_tags'));
 }
开发者ID:alons182,项目名称:guanacastevende,代码行数:20,代码来源:ProductsController.php


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