1
Ich habe diesen Code in meinem Laravel ControllerZustand in Controller Laravel
public function index($id=false) {
//get resto by name
$resto_nom = DB::table('restos as r')
->JOIN('produit as p', 'p.r_id', '=', 'r.r_id')
->JOIN('categorie as c', 'c.ca_id', '=', 'p.ca_id')
->WHERE('r.r_nom', $id)
->WHERE('p.po_etat', 1)
->get();
foreach ($resto_nom as $r):
$r_nom = $r->r_nom;
$r_description = $r->r_description;
$r_specialite = $r->r_specialite;
$meta = $r_nom.', '.$r_specialite.", restaurant NosRepas, repas";
$description = $r_nom.' - '.$r_specialite.'. '.$r_description;
endforeach;
if($id != $r_nom){
return view('frontend.pages.resto', compact('meta', 'description', 'resto_nom'));
}else{
return view('frontend.pages.resto', compact('meta', 'description', 'resto_nom'));
}
}
Ich habe Fehler nach Undefined variable: r_nom
Mein Ziel ist die Anzeige, wenn der Wert korrekt gefunden ist so Display anzuzeigen und so falsch es gibt 404 nicht gefunden.
Vielen Dank für Ihre Hilfe –