php - Laravel 5.3 Password Broker Customization -


does know how override functions used within laravel's password broker? know docs:

https://laravel.com/docs/5.3/passwords#resetting-views

give information on things views , few surface level things it's not clear @ or maybe i'm not reading enough times.

i know how override resetspasswords.php trait overriding functionality of password::broker() next layer in.

if there more information needed can kindly provide some.

thank in advance.

i had face same issue, needed override of passwordbroker functions. after lot of investigation on web , many failed attempts so, ended following implementation:

  1. created custompasswordresetserviceprovider inside app\providers registered custompasswordbrokermanager instance.

    namespace app\providers; use illuminate\support\serviceprovider; use app\services\custompasswordbrokermanager;  class custompasswordresetserviceprovider extends serviceprovider{     protected $defer = true;      public function register()     {         $this->registerpasswordbrokermanager();     }      protected function registerpasswordbrokermanager()     {         $this->app->singleton('auth.password', function ($app) {             return new custompasswordbrokermanager($app);         });     }      public function provides()     {         return ['auth.password'];     } } 
  2. in config/app.php commented out line:
    //illuminate\auth\passwords\passwordresetserviceprovider::class,
    , added:
    app\providers\custompasswordresetserviceprovider::class,

  3. inside app\services folder created custompasswordbrokermanager , copied context of default passwordbrokermanager located at:
    illuminate\auth\passwords\passwordbrokermanager.php
    modified function resolve return instance of custompasswordprovider class.

    protected function resolve($name) {     $config = $this->getconfig($name);     if (is_null($config)) {         throw new invalidargumentexception("password resetter [{$name}] not defined.");     }      return new custompasswordbroker(         $this->createtokenrepository($config),         $this->app['auth']->createuserprovider($config['provider']) ); } 
  4. finally inside app\services folder created custompasswordbroker class extends default passwordbroker located at:
    illuminate\auth\passwords\passwordbroker , overridden functions needed.

    use illuminate\auth\passwords\passwordbroker basepasswordbroker;      class custompasswordbroker extends basepasswordbroker     {     // override functions need here     }       

not sure if best implementation worked me.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -