I want to access the id
of currently logged in user
My beforeDelete()
function in /app/models/course.php
:
function beforeDelete()
{
// Some code
// code also sets value of $uid2
$uid = $this->Auth->user('id'); //this is line 86 in course.php
if ($uid2 == $uid) {
return true;
}
else {
return false;
}
}
But during execution, I get the following error:
Notice (8): Undefined property: Course::$Auth [APP/models/course.php, line 86]
Fatal error: Call to a member function user() on a non-object in /var/www/some_path/app/models/course.php on line 86
Please suggest..