X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=production%2Fexample_apps%2Fshared_calendar%2Fsrc%2FModel%2FTable%2FUsersTable.php;fp=production%2Fexample_apps%2Fshared_calendar%2Fsrc%2FModel%2FTable%2FUsersTable.php;h=8f7040dfccdd269af1296648b948d8930b192ba1;hb=34d1cb2e8687b826357db1d3821bf9e05cf6f13d;hp=0000000000000000000000000000000000000000;hpb=21f30bb859e6c15393e23ac0e5ef417b82f628a5;p=feisty_meow.git diff --git a/production/example_apps/shared_calendar/src/Model/Table/UsersTable.php b/production/example_apps/shared_calendar/src/Model/Table/UsersTable.php new file mode 100644 index 00000000..8f7040df --- /dev/null +++ b/production/example_apps/shared_calendar/src/Model/Table/UsersTable.php @@ -0,0 +1,63 @@ +setTable('users'); + $this->setDisplayField('name'); + $this->setPrimaryKey('id'); + + $this->addBehavior('Timestamp'); + } + + /** + * Default validation rules. + * + * @param \Cake\Validation\Validator $validator Validator instance. + * @return \Cake\Validation\Validator + */ + public function validationDefault(Validator $validator) + { + $validator + ->integer('id') + ->allowEmpty('id', 'create'); + + $validator + ->requirePresence('name', 'create') + ->notEmpty('name'); + + $validator + ->allowEmpty('token'); + + return $validator; + } +}