本文整理汇总了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'));
}
示例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'));
}
示例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);
}
示例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'));
}
示例5: getAllwithPosts
public function getAllwithPosts()
{
return Tag::select('id', 'title')->with(['posts' => function ($q) {
$q->select('id', 'title')->active();
}])->get();
}
示例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());
});
}
示例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()]);
}
示例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;
}
示例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'));
}