本文整理汇总了PHP中app\Contact::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::setAttribute方法的具体用法?PHP Contact::setAttribute怎么用?PHP Contact::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Contact
的用法示例。
在下文中一共展示了Contact::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store(Request $request)
{
if (Auth::check()) {
$staff_id = Auth::user()->id;
$sfname = Auth::user()->fname;
$slname = Auth::user()->lname;
} else {
return redirect('auth/login');
}
$datedoc = Carbon::now(-6);
$contact = new Contact();
$contact->fname = $request->input('fname');
$contact->lname = $request->input('lname');
$contact->datedoc = $datedoc;
$contact->sfname = $sfname;
$contact->sfname = $sfname;
$contact->slname = $slname;
$contact->staff_id = $staff_id;
// $contact->eie = 0;
// $contact->dss = 0;
// $contact->client_id = 0;
//=== this section checks for ids ====
$inquiry_id = $request->input('inquiry_id');
$client_id = $request->input('client_id');
$episode_id = $request->input('episode_id');
$looper = 0;
$vals = array($inquiry_id, $client_id, $episode_id);
$flds = array('inquiry_id', 'client_id', 'episode_id');
foreach ($flds as $fld) {
$contact->setAttribute($fld, Input::has($fld) ? $vals[$looper] : '0');
$looper++;
}
//=======================
$morechks = array('eie', 'dss', 'isprimaryrefsrc', 'isroisigned', 'isrefsrc');
foreach ($morechks as $morechk) {
$contact->setAttribute($morechk, Input::has($morechk) ? true : false);
}
$contact->contactfname = $request->input('contactfname');
$contact->contactlname = $request->input('contactlname');
$contact->phone1 = $request->input('phone1');
$contact->phone1type = $request->input('phone1type');
$contact->phone2 = $request->input('phone2');
$contact->phone2type = $request->input('phone2type');
$contact->phone3 = $request->input('phone3');
$contact->phone3type = $request->input('phone3type');
$contact->reltoclient = $request->input('reltoclient');
$contact->refsrcreltoclient = $request->input('refsrcreltoclient');
$contact->address = $request->input('address');
$contact->city = $request->input('city');
$contact->usstate = $request->input('usstate');
$contact->zip = $request->input('zip');
// $contact->isrefsrc = $request->input('isrefsrc');
// $contact->isprimaryrefsrc = $request->input('isprimaryrefsrc');
// $contact->isroisigned = $request->input('isroisigned');
$contact->save();
return redirect()->route('inquiryview', $inquiry_id);
}