本文整理汇总了PHP中app\models\Contact::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::update方法的具体用法?PHP Contact::update怎么用?PHP Contact::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Contact
的用法示例。
在下文中一共展示了Contact::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* update Contact
*
* @param Business $business Business holding the Contact
* @param Contact $contact Contact to update
* @param AlterContactRequest $request Alter Contact Request
* @return Response Redirect back to edited Contact
*/
public function update(Business $business, Contact $contact, AlterContactRequest $request)
{
$this->log->info(__METHOD__);
$this->log->info(sprintf(" businessId:%s contactId:%s", $business->id, $contact->id));
//////////////////
// FOR REFACTOR //
//////////////////
$update = ['mobile' => $request->get('mobile'), 'mobile_country' => $request->get('mobile_country')];
/* Only allow filling empty fields, not modification */
if ($contact->birthdate === null && $request->get('birthdate')) {
$update['birthdate'] = $request->get('birthdate');
$this->log->info("BusinessContactController: update: Updated birthdate:{$update['birthdate']}");
}
if (trim($contact->nin) == '' && $request->get('nin')) {
$update['nin'] = $request->get('nin');
$this->log->info("BusinessContactController: update: Updated nin:{$update['nin']}");
}
$contact->update($update);
$this->log->info("BusinessContactController: update: Updated contact");
Flash::success(trans('user.contacts.msg.update.success'));
return redirect()->route('user.business.contact.show', [$business, $contact]);
}
示例2: update
public function update(Contact $contact, ContactRequest $request)
{
$contact->update($request->all());
return redirect('contact')->with('message', 'Contact successfully updated.');
}