Open alaksandarjesus opened 7 years ago
I get the same error when updating to Laravel 5.4. I will delay upgrading to the latest version for now and thank everyone in advance for any work getting a fix for this ;-)
1/1 FatalThrowableError in JWTAuthServiceProvider.php line 122: Call to undefined method Illuminate\Foundation\Application::share()
in JWTAuthServiceProvider.php line 122
at JWTAuthServiceProvider->registerUserProvider() in JWTAuthServiceProvider.php line 100
at JWTAuthServiceProvider->register() in Application.php line 568
at Application->register(object(JWTAuthServiceProvider)) in ProviderRepository.php line 74
at ProviderRepository->load(array('Illuminate\\Auth\\AuthServiceProvider', 'Illuminate\\Broadcasting\\BroadcastServiceProvider', 'Illuminate\\Bus\\BusServiceProvider', 'Illuminate\\Cache\\CacheServiceProvider', 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider', 'Illuminate\\Cookie\\CookieServiceProvider', 'Illuminate\\Database\\DatabaseServiceProvider', 'Illuminate\\Encryption\\EncryptionServiceProvider', 'Illuminate\\Filesystem\\FilesystemServiceProvider', 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider', 'Illuminate\\Hashing\\HashServiceProvider', 'Illuminate\\Mail\\MailServiceProvider', 'Illuminate\\Notifications\\NotificationServiceProvider', 'Illuminate\\Pagination\\PaginationServiceProvider', 'Illuminate\\Pipeline\\PipelineServiceProvider', 'Illuminate\\Queue\\QueueServiceProvider', 'Illuminate\\Redis\\RedisServiceProvider', 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider', 'Illuminate\\Session\\SessionServiceProvider', 'Laravel\\Tinker\\TinkerServiceProvider', 'Illuminate\\Translation\\TranslationServiceProvider', 'Illuminate\\Validation\\ValidationServiceProvider', 'Illuminate\\View\\ViewServiceProvider', 'App\\Providers\\AppServiceProvider', 'App\\Providers\\AuthServiceProvider', 'App\\Providers\\BroadcastServiceProvider', 'App\\Providers\\EventServiceProvider', 'App\\Providers\\RouteServiceProvider', 'Tymon\\JWTAuth\\Providers\\JWTAuthServiceProvider', 'Mpociot\\ApiDoc\\ApiDocGeneratorServiceProvider')) in Application.php line 543
at Application->registerConfiguredProviders() in RegisterProviders.php line 17
at RegisterProviders->bootstrap(object(Application)) in Application.php line 208
at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160
at Kernel->bootstrap() in Kernel.php line 144
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53
Same here.
jwt it's not 100% compatible with laravel 5.4 yet see https://github.com/tymondesigns/jwt-auth/pull/969
+1. It would be great If you could tag the develop branch that seems to have the fix for 5.4 =) Thanks youuu!!!
Looking at another project relying on the share method https://github.com/mpociot/laravel-apidoc-generator/pull/150/files this may be the approach:
// Change this in JWTAuthServiceProvider.php line 122:
$this->app['tymon.jwt.provider.user'] = $this->app->share(function ($app) {
// To this?
$this->app->singleton('tymon.jwt.provider.user', function ($app) {
There are further uses of share in this Class which would likely need updating too.
@spirant You should actually use singleton
. It's part of the upgrade guides.
https://laravel.com/docs/5.4/upgrade search for share
on there.
If not known yet. On release 1.0.0-beta.2 This doesn't seem to do anything, yet:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
I am getting this error after composer update.... I am using laravel version 5.4.*
Call to undefined method Illuminate\Foundation\Application::share()
My providers array
My alias array
My composer.json ,
"tymon/jwt-auth": "0.5.*"
The error is