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


PHP Auth\Authenticatable類代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Auth\Authenticatable的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticatable類的具體用法?PHP Authenticatable怎麽用?PHP Authenticatable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Authenticatable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: subscribed

 /**
  * Determine if the given user is subscribed to the given plan.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  string  $subscription
  * @param  string  $plan
  * @param  bool  $defaultSubscription
  * @return bool
  */
 protected function subscribed($user, $subscription, $plan, $defaultSubscription)
 {
     if (!$user) {
         return false;
     }
     return $defaultSubscription && $user->onGenericTrial() || $user->subscribed($subscription, $plan);
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:16,代碼來源:VerifyUserIsSubscribed.php

示例2: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     if (!isset($credentials['password'])) {
         return false;
     }
     return $user->getAuthPassword() === $credentials['password'];
 }
開發者ID:larasite,項目名稱:larasite,代碼行數:14,代碼來源:ConfigUserProvider.php

示例3: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  string                                     $token
  * @return void
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     if ($user->exists) {
         $user->setRememberToken($token);
         $user->save();
     }
 }
開發者ID:ssddanbrown,項目名稱:bookstack,代碼行數:14,代碼來源:LdapUserProvider.php

示例4: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     // $is_valid = $this->model->where('Username', '=', $credentials['Username'])->where('Password', '=', $credentials['Password'])->first() != null;
     $is_valid = $user->Username == $credentials['Username'] && $this->hasher->check($credentials['Password'], $user->getAuthPassword());
     return $is_valid;
     // $plain = $credentials['password'];
     // return $this->hasher->check($plain, $user->getAuthPassword());
 }
開發者ID:ahmadmuiz,項目名稱:wp_employee,代碼行數:15,代碼來源:CustomUserProvider.php

示例5: validateCredentials

 /**
  * @param Authenticatable $user
  * @param array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     if ($user->type == 'local') {
         $plain = $credentials['password'];
         return $this->hasher->check($plain, $user->getAuthPassword());
     }
     return true;
 }
開發者ID:h3r2on,項目名稱:shibboleth,代碼行數:13,代碼來源:ShibolethUserProvider.php

示例6: createActivity

 /**
  * Create user login activity
  *
  * @param Authenticatable $user
  * @param $event_name
  * @return bool
  */
 protected function createActivity($user, $event_name)
 {
     if (!$user) {
         return false;
     }
     Log::info('[' . strtoupper($event_name) . '] User #' . $user->id, $user->toArray());
     return true;
 }
開發者ID:aginev,項目名稱:login-activity,代碼行數:15,代碼來源:LogHandler.php

示例7: createNewProperty

 /**
  * Store a new property
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function createNewProperty(Request $request, Authenticatable $user)
 {
     $this->validate($request, ['description' => 'required|string', 'image_url' => 'required|url']);
     $newProperty = new VacationProperty($request->all());
     $user->properties()->save($newProperty);
     $request->session()->flash('status', "Property successfully created");
     return redirect()->route('property-index');
 }
開發者ID:TwilioDevEd,項目名稱:airtng-laravel,代碼行數:14,代碼來源:VacationPropertyController.php

示例8: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     if ($user instanceof CustomKeyAuthenticable) {
         $method = 'get' . ucfirst($user->getAuthKeyName());
     } else {
         $method = 'getEmail';
     }
     return app('hash')->check($credentials['password'], $user->getAuthPassword()) && trim(strtolower($credentials['email'])) === trim(strtolower($user->{$method}()));
 }
開發者ID:atrauzzi,項目名稱:laravel-doctrine,代碼行數:16,代碼來源:DoctrineAuthenticator.php

示例9: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     try {
         $result = $this->application->authenticate($credentials['email'], $credentials['password']);
         return $result->account->getHref() == $user->getAuthIdentifier();
     } catch (\Exception $e) {
         return false;
     }
 }
開發者ID:stormpath,項目名稱:stormpath-laravel-auth-driver,代碼行數:16,代碼來源:StormpathUserProvider.php

示例10: loadUserRelationships

 /**
  * Load the relationships for the given user.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return \Illuminate\Contracts\Auth\Authenticatable
  */
 protected function loadUserRelationships($user)
 {
     $user->load('subscriptions');
     if (Spark::usesTeams()) {
         $user->load(['ownedTeams.subscriptions', 'teams.subscriptions']);
         $user->currentTeam();
     }
     return $user;
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:15,代碼來源:UserRepository.php

示例11: configureTeamForNewUser

 /**
  * Attach the user to a team if an invitation exists, or create a new team.
  *
  * @param  RegisterRequest  $request
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 protected function configureTeamForNewUser(RegisterRequest $request, $user)
 {
     if ($invitation = $request->invitation()) {
         Spark::interact(AddTeamMember::class, [$invitation->team, $user]);
         $invitation->delete();
     } else {
         Spark::interact(CreateTeam::class, [$user, ['name' => $request->team]]);
     }
     $user->currentTeam();
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:17,代碼來源:Register.php

示例12: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(UserContract $user, array $credentials)
 {
     $plain = $credentials['password'];
     $options = array();
     if ($user instanceof User) {
         $options['salt'] = $user->salt;
         $options['byte_size'] = strlen($user->getAuthPassword());
     }
     return $this->hasher->check($plain, $user->getAuthPassword(), $options);
 }
開發者ID:drawmyattention,項目名稱:expauth,代碼行數:17,代碼來源:ExpressionEngineUserProvider.php

示例13: validatePassword

 protected function validatePassword(Authenticatable $user, array $credentials)
 {
     $username = $this->getUsernameFromCredentials($credentials);
     try {
         $user->logIn($username, $credentials['password']);
     } catch (ParseException $e) {
         return false;
     }
     return true;
 }
開發者ID:parziphal,項目名稱:parse,代碼行數:10,代碼來源:BaseProvider.php

示例14: requestChangePassword

 /**
  * Generate a token for password change and saves it in
  * the 'password_reminders' table with the email of the
  * user.
  *
  * @param Authenticatable $user An existent user.
  *
  * @return string Password reset token.
  */
 public function requestChangePassword(Authenticatable $user)
 {
     $email = $user->getReminderEmail();
     $token = $this->generateToken();
     $values = array('email' => $email, 'token' => $token, 'created_at' => new \DateTime());
     $table = $this->getTable();
     $this->app->make('db')->connection($user->getConnectionName())->table($table)->insert($values);
     $this->sendEmail($user, $token);
     return $token;
 }
開發者ID:joshle,項目名稱:confide,代碼行數:19,代碼來源:EloquentPasswordService.php

示例15: isMaxLimitOfCheckout

 public function isMaxLimitOfCheckout()
 {
     $count = $this->user->checkoutHistories()->notReturned()->count();
     if ($count >= 2) {
         return false;
     }
     return true;
 }
開發者ID:RainyRuRu,項目名稱:bookshelf,代碼行數:8,代碼來源:BookshelfService.php


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