Issue
i have some fields in my database table, and i want to display title
,description
and keywords
according to every page, Please let me know how i can display this. My database fields name are metatitle
,metadesc
,keyword
Here are my Controller code where i am displaying the property list...
public function listtype($slug){
$prtype= Listing::whereHas('proType',function($q) use($slug){
$q->where('slug','like','%'.$slug.'%');
})->paginate(50);
return view('property-type',compact('prtype','title'));
}
Solution
You can do the following way:
public function listtype($slug){
$prtype= Listing::whereHas('proType',function($q) use($slug){
$q->where('slug','like','%'.$slug.'%');
})->with('proType')->paginate(50);
dd($prtype); /** for checking **/
return view('property-type',compact('prtype', $prtype));
}
Answered By - Amit Senjaliya Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.