User case I'm trying to do, if a user not submit his company details always redirect user to company page.
In appController I have written like below beforeRender method
public function beforeRender(\Cake\Event\EventInterface $event) {
if( !is_null($this->Auth) )
{
if($this->getTable('Users')->hasCompany($this->Auth) == false){
return $this->redirect(['controller'=>'Companies','action'=>'edit']);
}
}
}
Here hasCompany method always return true or false. Here I'm trying to redirect user if hasCompany == false. But problem is like infinite loop browser just reloading.Redirection are not working.