Exemplo n.º 1
0
 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'));
 }
Exemplo n.º 2
0
 public function getTags()
 {
     return response()->json(['response_code' => 'RES_TAGS', 'messages' => 'Tags', 'data' => Tag::get()]);
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 5
0
 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]);
 }
Exemplo n.º 6
0
 /**
  * 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)]);
     }
 }