'any', 'requestData' => [ 'name' => [ 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_NAME, LengthConfig::MAX_LENGTH_NAME), 'error' => ERRORS::INVALID_NAME ], 'email' => [ 'validation' => DataValidator::email(), 'error' => ERRORS::INVALID_EMAIL ], 'password' => [ 'validation' => DataValidator::notBlank()->length(LengthConfig::MIN_LENGTH_PASSWORD, LengthConfig::MAX_LENGTH_PASSWORD), 'error' => ERRORS::INVALID_PASSWORD ], ] ]; } public function handler() { if(!Staff::isTableEmpty()) { throw new RequestException(ERRORS::INIT_SETTINGS_DONE); } $staff = new Staff(); $staff->setProperties([ 'name' => Controller::request('name'), 'email' => Controller::request('email'), 'password' => Hashing::hashPassword(Controller::request('password')), 'profilePic' => '', 'level' => 3, 'sharedDepartmentList' => Department::getAll(), 'sharedTicketList' => [], 'sendEmailOnNewTicket' => 1 ]); foreach(Department::getAll() as $department) { $department->owners++; $department->store(); } $staff->store(); Response::respondSuccess(); } }