<?php
class Contact extends AppModel{
    public $useTable='contacts';
    public $validationDomain = 'validation';
    public $actsAs = array('search-master.Searchable');
    public $belongsTo = array(
        'User'=>array(
            'className'=>'User',
            'foreignKey'=>'user_id'
        ),'Category','Location'
    );
    public $filterArgs = array(
        'cid' => array('field'=>'Contact.category_id'),
        'cname' => array('type'=>'like','field'=>array('Contact.name','Contact.mobile'))
    );
    public $validate = array(
        'name'=>array('alphaNumeric'=>array('rule' => 'alphaNumericCustom','required' => true,'allowEmpty' => false,'message' => 'Only letters and numbers allowed')),
        'location_id'=>array('numeric'=>array('rule'=>'numeric','message'=>'Only Number','allowEmpty'=>false,'required'=>true)),
        'category_id'=>array('numeric'=>array('rule'=>'numeric','message'=>'Only Number','allowEmpty'=>false,'required'=>true)),
        'user_id'=>array('numeric'=>array('rule'=>'numeric','message'=>'Only Number','allowEmpty'=>false,'required'=>true)),
        'phone'=>array('numeric' => array('rule'=>'numeric','required'=>true,'allowEmpty'=>true,'message'=>'Only numbers allowed')),
    );
}
?>
