/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $problems = DB::table('problemhastags')->join('tags', 'tags.id', '=', 'problemhastags.tag_id')->join('problems', 'problems.id', '=', 'problemhastags.problem_id')->where('tags.name', '=', $id)->select('problems.name as name', 'problems.id as id', 'tags.name as tag')->paginate(3);
     $hastags = problemhastag::all();
     $tag = tag::all();
     //return view('tags.show')->withProblems($problems)->withTag($id);
     return view('problems.index')->withProblems($problems)->withtaganame($id)->withhastags($hastags)->withtag($tag);
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     tag::create(['name' => 'Fiesta']);
     tag::create(['name' => 'Noche']);
     tag::create(['name' => 'Tutorial']);
     tag::create(['name' => 'Receta']);
     tag::create(['name' => 'PromociĆ³n']);
     tag::create(['name' => 'Entretenimiento']);
     tag::create(['name' => 'DiverciĆ³n']);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('articles', function ($id) {
         return \App\Article::published()->findOrFail($id);
     });
     $router->bind('tags', function ($name) {
         return \App\tag::where('name', $name)->firstOrFail();
     });
 }
Example #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($slug)
 {
     $data = post::findBySlugorfail($slug);
     if (Gate::denies('update', $data)) {
         Session::flash('success', 'No eres el creador!');
         return Redirect('/home');
     } else {
         $tags = tag::OrderBy('id', 'ASC')->lists('name', 'id');
         $mytags = $data->tags->lists('id')->toArray();
         return view('post.edit', compact('data', 'tags', 'mytags'));
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $tags = tag::all();
     $hasTags = problemhastag::all();
     return view('problems.edit')->withProblem(Problem::findOrFail($id))->withtags($tags)->withhastags($hasTags);
 }