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')); }
public function getTags() { return response()->json(['response_code' => 'RES_TAGS', 'messages' => 'Tags', 'data' => Tag::get()]); }
public function index() { $tags = \App\Tag::get(); return view('backend.tags.index', compact('tags')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return Tag::get(); }
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]); }
/** * 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')); }
/** * 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)]); } }