コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: TagsSeeder.php プロジェクト: Carlos-Stgo/Apppromo
 /**
  * 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']);
 }
コード例 #3
0
 /**
  * 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();
     });
 }
コード例 #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'));
     }
 }
コード例 #5
0
 /**
  * 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);
 }