Description
sir kindCategory() function me jo he wohi sab 1 function se kese show karun
karna kuch kis tarha he k jab flex per click karen to property kinds show hongi or first property kind me jo categories hen wo show honi chahiyen lekin ab index function me to ($id) nahi aa rahi to ye kese kar sakte hen. men aap ko sample image dikhata hun jisko follow kar raha hun .image me oper navbar me kinds hen or neeche categories
View Code
public function index()
{
$this->kind = PropertyKind::all();
return view('propertyv2::flex.index', $this->data);
}
public function kindCategory($id)
{
$this->kind = PropertyKind::all();
$this->category = Propertyv2Category::where('kind',$id)->get();
return view('propertyv2::flex.categories', $this->data);
}
Ap condition apply kr skty hain let me give you example
if ($request->category) { // agr category pe click ho ga to if exceute ho gi
$this->kind= Propertyv2Category::where('kind',$id)->get();
}
else {
$this->kind = PropertyKind::all();
}
return view('propertyv2::flex.categories', $this->kind);
0 Likes 2 Comments
Muhammad babar Khan Author
$this->kind= Propertyv2Category::where('kind',$id)->get(); is tarha to index function ko bhi $id chahiye hogi jisk liye route me bhi lagaon ?
Hadayat Niazi Super Admin
Hadayat Niazi Super Admin
If your problem is resolved, please mark this as solved. Thank you
yes optional route bna lein k id aa jaey to get kr ley otherwise all posts return kr dey