This is my home page route, where I get a random member:
Route::get('/', function()
{
$member = User::orderBy(DB::raw('RAND()'))->first();
return View::make('landing', compact('member'));
});
When the RemindersController
's postRemind
method sends the email, I'm doing this:
case Password::REMINDER_SENT:
return Redirect::to('/')->with('flash_message', 'Whatever message...');
And the home page returns:
Illuminate \ Database \ QueryException
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: select * from `users` order by RAND() asc limit 1)
If I refresh the page right there, it fixes itself..
I'm using getenv()
and .env.php
files to fill the database connection values. If I switch from that to hard code them in, it fixes the problem. And if I go back to using getenv()
it works too. However, as soon as I restart WAMP, I'm back to square 1.
What's going on?