本文整理匯總了PHP中Lead::findOrFail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lead::findOrFail方法的具體用法?PHP Lead::findOrFail怎麽用?PHP Lead::findOrFail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Lead
的用法示例。
在下文中一共展示了Lead::findOrFail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
public function update($id)
{
$lead = Lead::findOrFail($id);
$v = Validator::make($data = Input::except('id'), Lead::$rules);
if ($v->fails()) {
return Response::json(array('flash' => 'Something went wrong, try again !'), 500);
} else {
$user = Sentry::getUser();
$lead->salutation = Input::get('salutation');
$lead->first_name = Input::get('first_name');
$lead->last_name = Input::get('last_name');
$lead->phone = Input::get('phone');
$lead->email = Input::get('email');
$lead->instance = Input::get('instance');
$lead->address = Input::get('address');
$lead->address2 = Input::get('address2');
$lead->description = Input::get('description');
$lead->status_id = Input::get('status_id');
$lead->save();
$lead->users()->attach($user, array('notes' => 'Merubah data lead'));
return Response::json(array('success' => true, 'flash' => 'The lead has been successfully updated !'), 200);
}
}