What I am doing ?
I pass CategoryID
parameter value as default value to the where
clause
public function SubCategories($CategoryID)
{
$CandSubCat = \Cache::rememberForever('CandSubCat' . $CategoryID, function() {
return \App\Models\Skill\Category_Model
::where("CategoryID", "=", $CategoryID)
->with("SubCategories")
->first();
});
return view("Skill.SubCategory.List", array("CandSubCat" => $CandSubCat));
}
Question:
Why it gives runtime error, saying:
Undefined variable: CategoryID in Where Clause?