• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Auth\Authenticatable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Contracts\Auth\Authenticatable的典型用法代码示例。如果您正苦于以下问题:PHP Authenticatable类的具体用法?PHP Authenticatable怎么用?PHP Authenticatable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Authenticatable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getPendingInvitationsForUser

 /**
  * Get all of the pending invitations for the user.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getPendingInvitationsForUser($user)
 {
     $invitations = $user->invitations()->with('team.owner')->get();
     foreach ($invitations as $invite) {
         $invite->setVisible(['id', 'team']);
         $invite->team->setVisible(['name', 'owner']);
         $invite->team->owner->setVisible(['name']);
     }
     return $invitations;
 }
开发者ID:ReyRodriguez,项目名称:spark,代码行数:16,代码来源:TeamRepository.php


示例16: createSubscriptionOnStripe

 /**
  * Create the subscription on Stripe.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 protected function createSubscriptionOnStripe(Request $request, $user)
 {
     $plan = Spark::plans()->find($request->plan);
     $subscription = $user->subscription($plan->id);
     if ($plan->hasTrial()) {
         $subscription->trialFor(Carbon::now()->addDays($plan->trialDays));
     }
     if ($request->coupon) {
         $subscription->withCoupon($request->coupon);
     }
     $subscription->create($request->stripe_token, ['email' => $user->email]);
 }
开发者ID:mastashake08,项目名称:laravel-spark-archive,代码行数:19,代码来源:UserRepository.php


示例17: create

 /**
  * Creates an auth token for user.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  * @return \TAppleby\AuthToken\AuthToken|false
  */
 public function create(Authenticatable $user)
 {
     if ($user == null || $user->getAuthIdentifier() == null) {
         return false;
     }
     $token = $this->generateAuthToken();
     $token->setAuthIdentifier($user->getAuthIdentifier());
     $t = new \DateTime();
     $insertData = array_merge($token->toArray(), array('created_at' => $t, 'updated_at' => $t));
     $this->db()->insert($insertData);
     return $token;
 }
开发者ID:Rareloop,项目名称:laravel-auth-token,代码行数:18,代码来源:DatabaseAuthTokenProvider.php


示例18: validateMaximumTeamsNotExceeded

 /**
  * Validate that the maximum number of teams hasn't been exceeded.
  *
  * @param  \Illuminate\Validation\Validator  $validator
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 protected function validateMaximumTeamsNotExceeded($validator, $user)
 {
     if (!($plan = $user->sparkPlan())) {
         return;
     }
     if (is_null($plan->teams)) {
         return;
     }
     if ($plan->teams <= $user->ownedTeams()->count()) {
         $validator->errors()->add('name', 'Please upgrade your subscription to create more teams.');
     }
 }
开发者ID:defenestrator,项目名称:groid,代码行数:19,代码来源:CreateTeam.php


示例19: create

 /**
  * Store a new reservation
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function create(Client $client, Request $request, Authenticatable $user, $id)
 {
     $this->validate($request, ['message' => 'required|string']);
     $property = VacationProperty::find($id);
     $reservation = new Reservation($request->all());
     $reservation->respond_phone_number = $user->fullNumber();
     $reservation->user()->associate($property->user);
     $property->reservations()->save($reservation);
     $this->notifyHost($client, $reservation);
     $request->session()->flash('status', "Sending your reservation request now.");
     return redirect()->route('property-show', ['id' => $property->id]);
 }
开发者ID:TwilioDevEd,项目名称:airtng-laravel,代码行数:18,代码来源:ReservationController.php


示例20: handle

 /**
  * Handle user logged in.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  *
  * @return bool|null
  */
 public function handle(Authenticatable $user)
 {
     $social = $this->session->get('authentication.social.oauth');
     if (is_null($social)) {
         return;
     }
     $model = User::where('provider', '=', $social['provider'])->where('uid', '=', $social['user']->getId())->first();
     if (is_null($model)) {
         return;
     }
     $model->setAttribute('user_id', $user->getAuthIdentifier());
     $model->save();
     return true;
 }
开发者ID:vitalysemenov,项目名称:oauth,代码行数:21,代码来源:UserLoggedIn.php



注:本文中的Illuminate\Contracts\Auth\Authenticatable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Auth\CanResetPassword类代码示例发布时间:2022-05-23
下一篇:
PHP Container\Container类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap