Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

$this->app -> app() fixes ErrorException in Laravel 8 #9

Closed
wants to merge 1 commit into from

Conversation

fgd007
Copy link

@fgd007 fgd007 commented Sep 24, 2020

When using this package in an upgraded from Laravel 7 to Laravel 8 project I bump into ErrorExceptions in TwoFactorAuthManager.php

When changing $this->app to app() it seems to work fine again.

Great package btw!

@michaeldzjap
Copy link
Owner

michaeldzjap commented Sep 25, 2020

Hmmm... It seems they renamed $this->app to $this->container in Laravel 8 and introduced a dedicated $this->config member.

Your solution works, but I don't like the fact that the "magic" app() method now has to be called in each instance creation method, especially since the config information we need is already present as a (new) member.

So thanks for your PR, but I will probably go with another solution for this, which unfortunately would introduce a breaking change in this package and so would require a major version update. I will do this soon.

@michaeldzjap
Copy link
Owner

Proper support for Laravel 8 has been added in version 3. Should work for you now.

@fgd007
Copy link
Author

fgd007 commented Sep 25, 2020

Great that you found a better solution. I was looking in the Upgrade Guide for these kind of changes, but couldn't find any quickly. Your solution is the right one, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants