本文整理汇总了PHP中app\Contact::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::toArray方法的具体用法?PHP Contact::toArray怎么用?PHP Contact::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Contact
的用法示例。
在下文中一共展示了Contact::toArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postInsertContact
public function postInsertContact()
{
//创建验证规则
$rules = array('contact_time' => 'required', 'contact_phone' => 'required', 'content' => 'required');
//开始验证
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$contactRecord = new Contact();
$contactRecord->contact_time = Input::get('contact_time');
$contactRecord->contact_type = Input::get('contact_type');
$contactRecord->contact_man = Input::get('contact_man');
$contactRecord->contact_phone = Input::get('contact_phone');
$contactRecord->content = Input::get('content');
$contactRecord->contact_on = Input::get('contact_on');
$contactRecord->user_id = $this->_user->uid;
$contactRecord->username = $this->_user->username;
//$result = $contactRecord::firstOrCreate(Input::only('order_id', 'verify_id', 'contact_time', 'telephone', 'contact_type', 'contact_man', 'contact_phone', 'content','contact_on','user_id','username'));
if ($contactRecord->save()) {
//更新联系次数和最后一次联系时间
// $order = Order::where('verify_id', '=', $contactRecord->verify_id)->first();
// $order->contact_number = $order->contact_number + 1;
// $order->contact_lasted_at = $contactRecord->contact_time;
// $order->save();
$data = ['ret' => 0, 'data' => $contactRecord->toArray()];
exit(json_encode($data));
//$this->exitJson(Core_Modret::RET_SUCC,'','',$contactRecord->toArray());
} else {
$this->exitJson(Core_Modret::RET_SAVE_FAILED, "保存失败");
}
} else {
$this->exitJson(Core_Modret::RET_MISS_ARG, "缺少必要字段");
}
}