本文整理匯總了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)]);
}
}