本文整理汇总了PHP中app\Tag::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::all方法的具体用法?PHP Tag::all怎么用?PHP Tag::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Tag
的用法示例。
在下文中一共展示了Tag::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($username)
{
$articles = Article::where('user_id', '=', auth()->user()->id)->orderBy('created_at', 'desc')->get();
$categories = Category::all();
$tags = Tag::all();
return view('articles.new')->with(['articles' => $articles, 'categories' => $categories, 'tags' => $tags]);
}
示例2: editTag
public function editTag($id)
{
$notif = self::getNotif();
$currentTag = Tag::findOrFail($id);
$tags = Tag::all();
return view('adminPanel.editTag', compact('tags', 'currentTag', 'notif'));
}
示例3: tag
public function tag($name)
{
$tag = \App\Tag::where('name', '=', $name)->firstOrFail();
$tags = \App\Tag::all();
$posts = $tag->posts;
return view('frontend.pages.tag')->with('posts', $posts)->with('tags', $tags)->with('tag', $tag);
}
示例4: __construct
public function __construct()
{
$this->postParser = new PostParser();
$this->tags = Tag::all();
$this->dificultyLevels = PostDificulty::all();
$this->posts = Post::all();
}
示例5: tagTattoo
/**
* Display a listing of the resource.
*
* @return Response
*/
public function tagTattoo()
{
$user = Auth::user();
$tattoos = Tattoo::where('tags_count', 0)->paginate(20);
$tags = Tag::all();
return view('admin.tagTattoo', ['tattoos' => $tattoos, 'tags' => $tags]);
}
示例6: index
/**
* List the tags
* @param $date
*/
public function index()
{
$tags = Tag::all();
// return $articles;
// return view('articles.index')->with('articles', $articles);
return view('tags.index', compact('tags'));
}
示例7: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$post = Post::find($id);
$tags = Tag::all();
$title = 'Editer une conférence';
return view('dashboard.edit', compact('post', 'tags', 'title'));
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::Create();
foreach (range(1, 10) as $seededItem) {
User::create(['first_name' => $faker->name, 'last_name' => $faker->name, 'password' => Hash::make('123456'), 'type' => false, 'sex' => $faker->boolean(), 'email' => $faker->email, 'date_of_birth' => $faker->date('Y-m-d')]);
}
$users = User::all()->lists('id')->toArray();
foreach (range(1, 100) as $seededItem) {
Post::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0]);
}
$posts = Post::all()->lists('id')->toArray();
Comment::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0, 'parent_id' => null]);
foreach (range(1, 100) as $seededItem) {
Post_Vote::create(['user_id' => $faker->randomElement($users), 'post_id' => $faker->randomElement($posts), 'up' => $faker->boolean()]);
Comment::create(['user_id' => $faker->randomElement($users), 'parent_id' => $faker->randomElement(Comment::all()->lists('id')->toArray()), 'post_id' => $faker->randomElement($posts), 'body' => $faker->text, 'vote_count' => 0]);
Tag::create(['name' => $faker->text, 'private' => $faker->boolean()]);
}
$comments = Comment::all()->lists('id')->toArray();
$tags = Tag::all()->lists('id')->toArray();
foreach (range(1, 100) as $seededItem) {
Comment_Vote::create(['user_id' => $faker->randomElement($users), 'comment_id' => $faker->randomElement($comments), 'up' => $faker->boolean()]);
Tag_User::create(['user_id' => $faker->randomElement($users), 'tag_id' => $faker->randomElement($tags)]);
Post_Tag::create(['tag_id' => $faker->randomElement($tags), 'post_id' => $faker->randomElement($posts)]);
}
}
示例9: tagged
/**
* Display a listing of the resource associated with the tag name.
*
* @param Tag $tag
* @return \Illuminate\Http\Response
*/
public function tagged(Tag $tag)
{
$admin = User::first();
$tags = Tag::all();
$articles = $tag->publishedArticles()->get();
$currentTag = $tag;
return view($this->theme() . 'home', compact('articles', 'currentTag', 'admin', 'tags'));
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$product = Product::find($id);
$tags = Tag::all();
$cats = $this->categoryTitleAndId();
$product->status == 'published' ? $published = true : ($published = false);
return view('admin.product.edit', compact('product', 'cats', 'tags'));
}
示例11: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($slug)
{
$category = Category::where('slug', $slug)->first();
$articles = $category->articles()->get();
$categories = Category::all();
$tags = Tag::all();
return view('articles.categories.show', compact('articles', 'categories', 'tags'));
}
示例12: tag
public function tag($id)
{
$categories = $this->categories();
$articles = Tag::findOrFail($id)->articles()->orderBy('id', 'desc')->paginate(8);
$tag = Tag::findOrFail($id);
$tags = Tag::all();
return view('home.tag', compact('categories', 'tag', 'articles', 'tags'));
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$tags = Tag::all();
foreach ($tags as $tag) {
echo $tag->tag;
echo '<br>';
}
// return view('tags/tags')->with(['tags' => $tags]);
}
示例14: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
view()->composer('partials._blog-aside', function ($view) {
$view->with('postDate', Article::all()->groupBy(function ($date) {
return Carbon::parse($date->created_at)->format('M-y');
}));
$view->with('tags', Tag::all());
});
}
示例15: get_tags
public function get_tags()
{
$tags = Tag::all()->toArray();
$result = [];
foreach ($tags as $tag) {
$result[] = ['id' => $tag['id'], 'text' => $tag['name']];
}
return $result;
}