I wanted to have a variable in my controller that is accessible in my model. For instance,
<?php class MyController extends AppController{
function myFunction(){
// codes here
myvariable = "anything";
}
}
?>
and in my model,
<?php class myModel extends AppModel
function myModelFunction(){
// here i will use my variable to check on something.
if(myVariable != 0){ // myVariable here is from the controller
// do something here
}
}
?>
Now, is my code possible, I mean is it possible accessing a variable from my controller then use it on my model for checking or something else? Thanks.
Yes, pass it as an arg to your model method.