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