We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
This is exactly what I needed. Thank you!
Just what I was looking for. Thanks!
a very good start stidges.
Thanks! More content coming later today :)
Congrats on your first post :)
Thanks :)
Thanks, I hope this will help me to implement a dummy Connection for exporting migration scripts to SQL files, as required by some customer. I tried pretend() function, and it mostly works, but it still requires connection to a database, even when not actually using it, therefore I'll have to somehow override this behavior.
The only problem is that I will have to reconfigure ServiceProvider dynamically, in my custom Artisan command, and I'm not sure yet how to do it.
Fantastically helpful - thanks for this.
I ended up trying to overload classes Manager and DatabaseManager until I spotted the same bit of code you did - the 'db.connection.{$driver}' bit. At that point googled and eventually found your page which short-cut'ed the rest of the process.
I'm trying to overload the SQLite schema grammar (for in-memory testing) so that it adds default column values if they're not specified - the project I'm working on uses the non-strict mysql syntax :(
Is there any idea for singleton redis instance in laravel ?
Thanks anyway ; )
Cool idea with this blog. Hope to see a post on your with Maksim laravel-tricks.com project here, which btw is a great resource of learning already.
Can't wait for more posts anyway.
Cool article, but not applicable for (at least) Laravel 5.5
Illuminate\Database\Connectors\ConnectionFactory@createConnection
It handles default drivers but also allows for custom one and/or replacements to be inserted:
if ($resolver = Connection::getResolver($driver)) {
return $resolver($connection, $database, $prefix, $config);
}
So, updated version of your DatabaseServiceProvider would be:
public function boot() {
Connection::resolverFor('mysql', function($connection, $database, $prefix, $config) {
return new MySqlConnection($connection, $database, $prefix, $config);
});
}
Also, it's important to register this service provider BEFORE Illuminate\Database\DatabaseServiceProvider::class