[4.3] Auth driver 'eloquent' not working
Illuminate\Database\Eloquent\Model throws an exception "Call to a member function connection() on a non-object" on line 2840. My database connection is set up correctly. With driver 'database', Auth is working just fine.
/**
* Resolve a connection instance.
*
* @param string $connection
* @return \Illuminate\Database\Connection
*/
public static function resolveConnection($connection = null)
{
return static::$resolver->connection($connection);
}
Getting this also. Looks like boot() on DatabaseServiceProvider class is not getting called?
hummm, I guess I have some code on my AppServiceProvider that is using db, if on providers array from config/app.php, I place Illuminate\Database\DatabaseServiceProvider first, it will fix the error.
As 4.3 is WIP, too early to report issues.
Not at all, if there is a bug, it should be fixed.
Pretty sure you're going something with $app ['db'] in register() method when you should be using boot() method.
@crynobone, no such thing anywhere throughout my app.
Is this replicable on a fresh installation of 4.3 (not upgrading existing app)?
My app is actually built on a fresh installation. But fair point nonetheless. Will try to replicate this issue on a separate fresh 4.3 and report back.
I have: View::share('currentUser', Auth::user());
On boot() from AppServiceProvider.
It will work fine if no authentication was made, but just after I authenticate, I will get that error.
If I comment that line the error disappears.
Not sure if I should add that line there... Before I was adding on a setupLayout() of BaseController but that stop working for some reason on 4.3.
Do you tested with something like that? How I should do that?
Actually, @mfsousa and @crynobone, you both pointed me in the right direction: In fact I had included in AppServiceProvider's boot section a custom facade method that would involve db access via the Session facade when logged in, which I hadn't realized until following the call stack with xdebug. Now, per @mfsousa's point, I could move AppServiceProvider down the list of service providers in config.app. However, I'll rather admit I misunderstood the purpose of AppServiceProvider to begin with and should bootstrap my stuff differently. Either way, not a Laravel issue for sure and thus closed. Thank you sirs for your help!