本文整理汇总了PHP中Subscriber::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::findOrFail方法的具体用法?PHP Subscriber::findOrFail怎么用?PHP Subscriber::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postChangePassword
public function postChangePassword()
{
$input = Input::all();
$admin = Subscriber::findOrFail(Auth::user()->id)->first();
if (!Hash::check($input['current'], $admin->pword)) {
$this->notifyError("Invalid Current Password.");
return Redirect::back();
}
$rules = Config::get('validations.admin_password', NULL);
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Redirect::back()->withInput()->withErrors($v);
}
$admin->pword = Hash::make($input['password']);
$admin->clear_pword = $input['password'];
if ($admin->save()) {
$this->notifySuccess("Admin Password Successfully Updated.");
} else {
$this->notifyError("Failed to update admin password, please try again..");
}
return Redirect::back();
}
示例2: postChangePassword
public function postChangePassword()
{
$user_id = Input::get('user_id', 0);
$current = Input::get('current', NULL);
$user = Subscriber::findOrFail($user_id);
if ($user->clear_pword != $current) {
$this->notifyError("Incorrect current password.");
return Redirect::back();
}
$password = Input::get('password', NULL);
$confirm = Input::get('confirm_password', NULL);
if ($password != $confirm) {
$this->notifyError("New password & confirm password do not match.");
return Redirect::back();
}
$user->clear_pword = $password;
$user->pword = Hash::make($password);
if ($user->save()) {
$this->notifySuccess("Password Updated.");
} else {
$this->notifyError("Password Updation Failed.");
}
return Redirect::back();
}
示例3: postChangeServiceType
public function postChangeServiceType()
{
try {
// pr(Input::all());
$user_id = Input::get('user_id');
$user = Subscriber::findOrFail($user_id);
$disconnect = new stdClass();
$disconnect->set = FALSE;
DB::transaction(function () use($user, $disconnect) {
$plan_type = Input::get('plan_type');
if ($user->plan_type != $plan_type) {
$disconnect->set = TRUE;
}
$user->plan_type = $plan_type;
if (!$user->save()) {
throw new Exception('Failed to change service type.');
}
if ($user->plan_type == ADVANCEPAID_PLAN) {
$billing = BillingCycle::firstOrNew(['user_id' => $user->id]);
$input = Input::all();
$input['expiration'] = date("Y-m-d H:i:s", strtotime($input['expiration']));
$billing->fill($input);
if (!$billing->save()) {
throw new Exception("Failed to save billing cycle details.");
}
// pr($billing->toArray());
}
if ($user->plan_type == FREE_PLAN) {
Subscriber::updateFreePlan($user->id);
}
});
if ($disconnect->set) {
Subscriber::destroyAllSessions($user);
}
$this->notifySuccess("Service Type Updated.");
} catch (Exception $e) {
$this->notifyError($e->getMessage());
return Redirect::route('subscriber.profile', $user_id);
}
return Redirect::route('subscriber.profile', $user_id);
}
示例4: getAssignRoute
public function getAssignRoute($user_id)
{
$user = Subscriber::findOrFail($user_id);
return View::make("admin.subnet.assign-route")->with('profile', $user);
}