本文整理汇总了PHP中app\Tag类的典型用法代码示例。如果您正苦于以下问题:PHP Tag类的具体用法?PHP Tag怎么用?PHP Tag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: includeArticles
/**
* Include articles.
*
* @param \App\Tag $tag
* @param \League\Fractal\ParamBag|null $params
* @return \League\Fractal\Resource\Collection
* @throws \Exception
*/
public function includeArticles(Tag $tag, ParamBag $params = null)
{
$transformer = new \App\Transformers\ArticleTransformer($params);
$parsed = $this->getParsedParams();
$articles = $tag->articles()->limit($parsed['limit'])->offset($parsed['offset'])->orderBy($parsed['sort'], $parsed['order'])->get();
return $this->collection($articles, $transformer);
}
示例2: 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'));
}
示例3: show
public function show(Tag $tag)
{
$articles = $tag->articles()->published('<')->get();
// if published date is not required then
// below line can be used :)
// $articles = $tag->articles
return view('articles.index', compact('articles'));
}
示例4: store_tag
public function store_tag(Request $request)
{
$name = $request->name;
$tag = new Tag();
$tag->name = $name;
$tag->save();
return redirect('manage/producttags');
}
示例5: seedTags
private function seedTags($faker)
{
foreach (range(0, 100) as $number) {
$tag = new Tag();
$tag->name = $faker->word;
$tag->save();
}
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(Tag $tag)
{
if (Auth::user() && Auth::user()->isAdmin()) {
$posts = $tag->post()->simplePaginate(10);
} else {
$posts = $tag->post()->publics()->simplePaginate(10);
}
return view('tags.show', compact('posts', 'tag'));
}
示例7: seedTags
private function seedTags($faker)
{
foreach (range(0, 100) as $number) {
$tag = new Tag();
$tag->title = $faker->word;
// $tag->onoff =$faker->boolean;
$tag->save();
}
}
示例8: store
public function store(TagRequest $request)
{
//$this->createTags($request);
$tag = new Tag();
$tag->name = $request->input('name');
$tag->save();
\Session::flash('flash_message', 'Tag has been added!');
return redirect('tags');
}
示例9: seedTags
public function seedTags($faker)
{
foreach (range(0, 100) as $number) {
$tag = new Tag();
$tag->name = $faker->word;
$tag->random_bool = $faker->boolean;
$tag->save();
}
}
示例10: seedTags
private function seedTags($faker)
{
foreach (range(0, 100) as $item) {
$tag = new Tag();
$tag->title = $faker->word;
// $tag->prova = $faker->boolean();
$tag->save();
}
}
示例11: sendTags
private function sendTags($faker)
{
foreach (range(0, 100) as $number) {
$tag = new Tag();
$tag->name = $faker->word;
//$tag->tran = $faker->boolean;
$tag->save();
}
}
示例12: seedTags
/**
* @param Faker $faker
*/
private function seedTags(Faker $faker)
{
foreach (range(0, 100) as $item) {
$tag = new Tag();
$tag->name = $faker->world;
$tag->prova = $faker->boolean();
$tag->save();
}
}
示例13: destroy
public function destroy(Tag $tag)
{
if (!$tag->transactions->isEmpty()) {
flash()->error('Tag cannot be removed while in use');
return redirect()->route('tag.index');
}
$tag->delete();
flash()->success('Tag removed successfully');
return redirect()->route('tag.index');
}
示例14: all
public function all()
{
$tag = new Tag();
$all = Tag::all(['id', 'tag as text']);
if (\Input::has('isWeekly')) {
$weeklyTag = $tag->getRecentlyWeeklyTag();
return ['tags' => $all, 'wrTag' => $weeklyTag];
}
return $all;
}
示例15: show
public function show(Tag $tag)
{
// if (Gate::denies('update', $tag)) {
// abort(403, Message::HTTP_403);
// }
// $this->authorize('update', $tag);
// if (auth()->user()->can('update', $tag)) {
// return 'You can';
// }
$articles = $tag->articles()->paginate(5);
return view('articles.index', compact('articles'));
}