本文整理匯總了PHP中app\Profile::insertConact方法的典型用法代碼示例。如果您正苦於以下問題:PHP Profile::insertConact方法的具體用法?PHP Profile::insertConact怎麽用?PHP Profile::insertConact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Profile
的用法示例。
在下文中一共展示了Profile::insertConact方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
public function update(Request $request)
{
if (Auth::check()) {
$all = $request->all();
Validator::extend('mobile', function ($attribute, $value, $parameters) {
return preg_match('/^1[34578]\\d{9}$/', $value);
});
$validator = Validator::make($all, $this->rules);
if ($validator->fails()) {
$warnings = $validator->messages();
$show_warning = $warnings->first();
return $this->_returnMessageFile($show_warning, 100);
}
$disk = QiniuStorage::disk('qiniu');
$all['url'] = '';
if (!empty($_FILES["img"]["tmp_name"])) {
if ($disk->put(date('Y/m/d') . '/' . md5($_FILES["img"]["name"]), file_get_contents($_FILES["img"]["tmp_name"]))) {
$all['url'] = $disk->downloadUrl(date('Y/m/d') . '/' . md5($_FILES["img"]["name"]));
}
}
$user_info = $this->project->getInfo($request->user()->id);
if (empty($user_info)) {
$insert = $this->project->insertInfo($request->user()->id, $all);
if ($insert != 1) {
return $this->_returnMessageFile('插入失敗', 101);
}
} else {
$update = $this->project->updateInfo($request->user()->id, $all);
if ($update != 1) {
return $this->_returnMessageFile('更新失敗', 101);
}
}
$profile = new Profile();
$prof_info = $profile->getInfo($request->user()->id);
if (empty($prof_info)) {
$insert = $profile->insertConact($request->user()->id, $all);
if ($insert != 1) {
return $this->_returnMessageFile('插入失敗', 101);
}
} else {
$update = $profile->updateConact($request->user()->id, $all);
if ($update != 1) {
return $this->_returnMessageFile('更新失敗', 101);
}
}
return $this->_returnMessageFile('修改成功', 200);
} else {
return redirect()->guest('login');
}
}