Beispiel #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     $med = Meds::where('slug', $slug)->firstorFail();
     $czynnik = $med->skladnik_aktywny;
     $medLike = Meds::where('skladnik_aktywny', $czynnik)->limit(6)->get();
     $czynnik2 = $med->skladnik_aktywny2;
     $medLike2 = Meds::where('skladnik_aktywny2', $czynnik2)->limit(6)->get();
     $articleSide = Article::all()->random(2);
     return view('show', compact('med', 'medLike', 'czynnik', 'medLike2', 'czynnik2', 'articleSide'));
 }
 public function search(Requests\SearchRequest $request)
 {
     $term = Input::get('q');
     $term = addslashes($term);
     $queries = Meds::where('name', '=', $term)->firstOrFail();
     if (isset($queries)) {
         $url = $queries->slug;
         return redirect('/lek/' . $url);
     } else {
         return redirect('/');
     }
 }