Hi,
I have an edit action in the users controller. What I want to do is redirect anyone to a different action if their Auth.User.id does not equal the id of the user they are trying to edit.
I can access variables in my views like this:
if($session->read('Auth.User.id') != $id){
but this doesn't work in my controller. Getting:
Undefined variable: session
How do I access session data within a controller? also, if any has a better way of achieving what I want to do, feel free to add!
Thanks,
Jonesy