本文整理汇总了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);
}
}