當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Subscriber::findOrFail方法代碼示例

本文整理匯總了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();
 }
開發者ID:guilhermefilippo,項目名稱:access-manager,代碼行數:22,代碼來源:AdminProfileController.php

示例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();
 }
開發者ID:guilhermefilippo,項目名稱:access-manager,代碼行數:24,代碼來源:UserController.php

示例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);
 }
開發者ID:guilhermefilippo,項目名稱:access-manager,代碼行數:41,代碼來源:AccountsController.php

示例4: getAssignRoute

 public function getAssignRoute($user_id)
 {
     $user = Subscriber::findOrFail($user_id);
     return View::make("admin.subnet.assign-route")->with('profile', $user);
 }
開發者ID:guilhermefilippo,項目名稱:access-manager,代碼行數:5,代碼來源:SubnetController.php


注:本文中的Subscriber::findOrFail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。