mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Add new db discovery middleware
This commit is contained in:
parent
c25e2e6a6d
commit
e33273e360
30
app/Http/Middleware/SetWebDb.php
Normal file
30
app/Http/Middleware/SetWebDb.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use Closure;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
|
||||
class SetWebDb
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (config('ninja.db.multi_db_enabled'))
|
||||
{
|
||||
|
||||
MultiDB::setDB(Cookie::get('db'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user