laravel - Missing argument 1 for Illuminate\\Support\\Manager::createDriver() -


i had @ every post related error in laravel:

missing argument 1 illuminate support manager - createdriver()

2th link

3th link

none of them solved issue: using laravel lumen version 5.4 , dingo api package.

i want access authenticated user in incoming request:

 $request->user(); //returns instance of authenticated user 

however throw me error saying:

missing argument 1 illuminate\support\manager::createdriver(), called in /var/www/html/myapp/vendor/illuminate/support/manager.php on line 88 , defined",

i know in order authenticated user, need provide auth middleware inside routing:

  $api->get('register/{accountid}', ['middleware' => 'auth', 'app\http\controllers\api\v1\registercontroller@registeraction']); 

but adding middleware auth inside route not reach controller endpoint , throw same error can see above.

i have authserviceprovider registered in bootstrap/app.php:

 $app->register(app\providers\authserviceprovider::class); 

and authserviceprovider class:

 <?php   namespace app\providers;   use app\models\account;  use illuminate\support\serviceprovider;   class authserviceprovider extends serviceprovider {   /**    * register application services.    *    * @return void    */    public function register() {    }    /**    * boot authentication services application.    *    * @return void    */    public function boot() {     // here may define how wish users authenticated lumen     // application. callback receives incoming request instance     // should return either user instance or null. you're free obtain     // user instance via api token or other method necessary.      $this->app['auth']->viarequest('api', function ($request) {          if ($request->input('api_token')) {             return account::where('api_token', $request->input('api_token'))->first();         }     });    }   } 

this have in config/auth.php:

  <?php    return [  /* |-------------------------------------------------------------------------- | authentication defaults |-------------------------------------------------------------------------- | | option controls default authentication "guard" , password | reset options application. may change these defaults | required, they're perfect start applications. | */  'defaults' => [     'guard' => 'web',     'passwords' => 'users', ],  /* |-------------------------------------------------------------------------- | authentication guards |-------------------------------------------------------------------------- | | next, may define every authentication guard application. | of course, great default configuration has been defined | here uses session storage , eloquent user provider. | | authentication drivers have user provider. defines how | users retrieved out of database or other storage | mechanisms used application persist user's data. | | supported: "session", "token" | */  'guards' => [     'web' => [         'driver' => 'session',         'provider' => 'users',     ],      'api' => [         'driver' => 'token',         'provider' => 'users',     ], ],  /* |-------------------------------------------------------------------------- | user providers |-------------------------------------------------------------------------- | | authentication drivers have user provider. defines how | users retrieved out of database or other storage | mechanisms used application persist user's data. | | if have multiple user tables or models may configure multiple | sources represent each model / table. these sources may | assigned authentication guards have defined. | | supported: "database", "eloquent" | */  'providers' => [     'users' => [         'driver' => 'eloquent',         'model' => app\user::class,     ], ],  /* |-------------------------------------------------------------------------- | resetting passwords |-------------------------------------------------------------------------- | | may specify multiple password reset configurations if have more | 1 user table or model in application , want have | separate password reset settings based on specific user types. | | expire time number of minutes reset token should | considered valid. security feature keeps tokens short-lived | have less time guessed. may change needed. | */  'passwords' => [     'users' => [         'provider' => 'users',         'table' => 'password_resets',         'expire' => 60,     ],  ],  ]; 

i tried debug issue myself , found out breaking in laravel:

/**  * create new driver instance.  *  * @param  string  $driver  * @return mixed  *  * @throws \invalidargumentexception  */ protected function createdriver($driver) {     // we'll check see if creator method exists given driver. if not     // check custom driver creator, allows developers create     // drivers using own customized driver creator closure create it.     if (isset($this->customcreators[$driver])) {         return $this->callcustomcreator($driver);     } else {         $method = 'create'.str::studly($driver).'driver';          if (method_exists($this, $method)) {             return $this->$method();         }     }     throw new invalidargumentexception("driver [$driver] not supported."); } 

i can see in stacktrace passing null driver inside createdriver() method cause error i'm having. wonder if not simple configuration thing have add inside .env file.

i starting laravel lumen, it's great tool building api , i'm not blaming tool (i took lot of time reading beautiful documentation), i'm pretty sure missed simple, if can guide me this, pleased.

are using laravel scout (with algolia search driver)?

i came across errors seen while running database seeds. in end, realized tired mind forgot define correct env variables in .env file, below:

scout_driver=algolia algolia_app_id=youralgoliaappid algolia_secret=youralgoliasecret 

if haven't published scout config file, following command:

php artisan vendor:publish --provider="laravel\scout\scoutserviceprovider"

make sure have put 'laravel\scout\scoutserviceprovider::class' in providers array in 'config/app.php' before running above command.

once published config file (named config/scout.php default), used env variables below:

<?php  return [      /*     |--------------------------------------------------------------------------     | default search engine     |--------------------------------------------------------------------------     |     | option controls default search connection gets used while     | using laravel scout. connection used when syncing models     | search service. should adjust based on needs.     |     | supported: "algolia", "elasticsearch", "null"     |     */      'driver' => env('scout_driver'),      /*     |--------------------------------------------------------------------------     | index prefix     |--------------------------------------------------------------------------     |     | here may specify prefix applied search index     | names used scout. prefix may useful if have multiple     | "tenants" or applications sharing same search infrastructure.     |     */      'prefix' => env('scout_prefix', ''),      /*     |--------------------------------------------------------------------------     | queue data syncing     |--------------------------------------------------------------------------     |     | option allows control if operations sync data     | search engines queued. when set "true"     | automatic data syncing queued better performance.     |     */      'queue' => false,      /*     |--------------------------------------------------------------------------     | algolia configuration     |--------------------------------------------------------------------------     |     | here may configure algolia settings. algolia cloud hosted     | search engine works great scout out of box. plug     | in application id , admin api key started searching.     |     */      'algolia' => [         'id' => env('algolia_app_id'),         'secret' => env('algolia_secret'),     ],  ]; 

once did of above, errors went away. answer might not directly address exact issue, perhaps give thoughts or aid troubleshooting process.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -