/**
* initialize
*
* @param array $config Config.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->setController($this->_registry->getController());
// adding request handler
$this->Controller->loadComponent('RequestHandler');
// accepts json
$this->Controller->RequestHandler->renderAs($this->Controller, 'json');
// set the default modelName
if (is_null($this->config('modelName'))) {
$this->config('modelName', $this->Controller->name);
}
if (Configure::read('Api.JWT')) {
if ($this->Controller->Auth) {
$this->Controller->Auth->config('authenticate', ['ADmad/JwtAuth.Jwt' => ['parameter' => '_token', 'userModel' => 'Users.Users', 'scope' => ['Users.active' => 1], 'fields' => ['id' => 'id']]]);
}
}
}