invoiceninja/app/Http/Middleware/SetWebDb.php

28 lines
485 B
PHP
Raw Permalink Normal View History

2019-05-22 13:46:42 +10:00
<?php
namespace App\Http\Middleware;
use App\Libraries\MultiDB;
use Closure;
2019-05-22 13:48:25 +10:00
use Cookie;
2020-10-28 21:10:49 +11:00
use Illuminate\Http\Request;
2019-05-22 13:46:42 +10:00
class SetWebDb
{
/**
* Handle an incoming request.
*
2020-10-28 21:10:49 +11:00
* @param Request $request
* @param Closure $next
2019-05-22 13:46:42 +10:00
* @return mixed
*/
public function handle($request, Closure $next)
{
if (config('ninja.db.multi_db_enabled')) {
2019-05-22 13:46:42 +10:00
MultiDB::setDB(Cookie::get('db'));
}
return $next($request);
}
}