pictcode / app / Model / ContactValidate.php @ 67acbfb5
履歴 | 表示 | アノテート | ダウンロード (1.786 KB)
| 1 |
<?php
|
|---|---|
| 2 |
App::uses('AppModel', 'Model'); |
| 3 |
/**
|
| 4 |
* ContactValidate Model
|
| 5 |
*
|
| 6 |
*/
|
| 7 |
class ContactValidate extends AppModel { |
| 8 |
|
| 9 |
public $useTable = false; |
| 10 |
public $name = 'ContactValidate'; |
| 11 |
|
| 12 |
public $_schema = array( |
| 13 |
'name' => array( |
| 14 |
'type' => 'string', |
| 15 |
'length' => 128, |
| 16 |
), |
| 17 |
'mail' => array( |
| 18 |
'type' => 'string', |
| 19 |
'length' => 255, |
| 20 |
), |
| 21 |
'comment' => array( |
| 22 |
'type' => 'string', |
| 23 |
'length' => 255, |
| 24 |
), |
| 25 |
); |
| 26 |
|
| 27 |
/**
|
| 28 |
* Validation rules
|
| 29 |
*
|
| 30 |
* @var array
|
| 31 |
*/
|
| 32 |
public $validate = array( |
| 33 |
'name' => array( |
| 34 |
'rule' => array('notBlank'), |
| 35 |
'message' => 'この項目は入力必須です' |
| 36 |
), |
| 37 |
'email' => array( |
| 38 |
array(
|
| 39 |
'rule' => array('notBlank'), |
| 40 |
'message' => 'メールアドレスを入力してください' |
| 41 |
), |
| 42 |
// メールアドレスであること。
|
| 43 |
'isEmail' => array( |
| 44 |
'rule' => 'Email', |
| 45 |
'message' => '正しいメールアドレスを入力してください' |
| 46 |
), |
| 47 |
array(
|
| 48 |
'rule' => 'emailConfirm', |
| 49 |
'message' => 'メールアドレスが一致していません' |
| 50 |
), |
| 51 |
), |
| 52 |
'email_confirm' => array( |
| 53 |
array(
|
| 54 |
'rule' => array('notBlank'), |
| 55 |
'message' => 'メールアドレス(確認)を入力してください' |
| 56 |
), |
| 57 |
), |
| 58 |
|
| 59 |
'comment' => array( |
| 60 |
'notblank' => array( |
| 61 |
'rule' => array('notblank'), |
| 62 |
'message' => '入力されていません', |
| 63 |
), |
| 64 |
), |
| 65 |
); |
| 66 |
|
| 67 |
|
| 68 |
public function emailConfirm($check){ |
| 69 |
//2つのパスワードフィールドが一致する事を確認する
|
| 70 |
if($this->data['ContactValidate']['email'] === $this->data['ContactValidate']['email_confirm']){ |
| 71 |
return true; |
| 72 |
}else{
|
| 73 |
return false; |
| 74 |
} |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
} |