本文整理匯總了PHP中app\models\Customer::email方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customer::email方法的具體用法?PHP Customer::email怎麽用?PHP Customer::email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Customer
的用法示例。
在下文中一共展示了Customer::email方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: change
/**
* Change password
*
* @return Response
*/
public function change()
{
if (!Input::has('email') || !Input::has('password')) {
return new JSend('error', (array) Input::all(), 'Tidak ada data customer.');
}
$email = Input::get('email');
$password = Input::get('password');
$errors = new MessageBag();
DB::beginTransaction();
//1. Check Email
$customer_data = \App\Models\Customer::email($email)->notSSOMedia(['facebook'])->first();
if (!$customer_data) {
$errors->add('Customer', 'Email tidak valid.');
} elseif (empty($customer_data->reset_password_link)) {
$errors->add('Customer', 'Email tidak valid.');
} else {
//if validator passed, save customer
$customer_data = $customer_data->fill(['reset_password_link' => '', 'password' => $password, 'date_of_birth' => strtotime($customer_data['date_of_birth']) ? $customer_data['date_of_birth']->format('Y-m-d H:i:s') : '']);
if (!$customer_data->save()) {
$errors->add('Customer', $customer_data->getError());
}
}
if ($errors->count()) {
DB::rollback();
return new JSend('error', (array) Input::all(), $errors);
}
DB::commit();
$final_customer = \App\Models\Customer::id($customer_data['id'])->first()->toArray();
return new JSend('success', (array) $final_customer);
}