本文整理汇总了PHP中app\Tag::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::get方法的具体用法?PHP Tag::get怎么用?PHP Tag::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Tag
的用法示例。
在下文中一共展示了Tag::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit(Request $request, $id)
{
$station = \App\Station::findOrFail($id);
if (!$request->user()->isAdmin() && $station->user_id != $request->user()->id) {
return abort(403);
}
$selected_tags = old('tags', $station->tags()->lists('name')->toArray());
$tags = array_unique(array_merge($selected_tags, \App\Tag::get()->lists('name')->toArray()));
return view('backend.stations.edit', compact('station', 'tags', 'selected_tags'));
}
示例2: getTags
public function getTags()
{
return response()->json(['response_code' => 'RES_TAGS', 'messages' => 'Tags', 'data' => Tag::get()]);
}
示例3: index
public function index()
{
$tags = \App\Tag::get();
return view('backend.tags.index', compact('tags'));
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return Tag::get();
}
示例5: allElementsV2
public function allElementsV2()
{
$output = ['tags' => Tag::get(), 'cities' => Cities::with('Areas')->get(), 'states' => States::get(), 'countries' => Countries::get(), 'appElements' => AppElement::find(1)];
return response()->json(['response_code' => 'RES_STS', 'messages' => 'States', 'data' => $output]);
}
示例6: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$product = Product::findOrFail($id);
$categories = Category::lists('title', 'id');
$tags = Tag::get();
$timeFromInput = $product->published_at;
$time = Carbon::parse($timeFromInput)->format('d-m-Y');
return view('back.products.edit', compact('product', 'categories', 'tags', 'time'));
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
$stories = Story::get()->lists('id')->all();
$tags = Tag::get()->lists('id')->all();
foreach (range(1, 10) as $index) {
DB::table('story_tag')->insert(['story_id' => $faker->randomElement($stories), 'tag_id' => $faker->randomElement($tags)]);
}
}