I have one view which is calling one helper function and in that function, I want to access the variable which is passed in the view from controller I tried use statemen but still, I am getting an error of undefined variable here is my code.
return view('myview')->with([
'myvariablename' => true, ]);
below is code in my view file
@if(myHelperFunction()){
// do stuff
}
here is my code in helper function where I want to use that variable which is passed from controller to view.
function myHelperFunction()
{
if (isset($myvariablename) && $myvariablename) {
return true;
}
return false;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire