mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 23:14:34 -04:00
* Tests for authentication * Add db field to company table (required if we are doing jobs without an auth()->user() ) * Add Laravel Dusk for browser testing, add ability to set DB by incoming URL Hash
27 lines
470 B
PHP
27 lines
470 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Libraries\MultiDB;
|
|
use Closure;
|
|
|
|
class SetDb
|
|
{
|
|
/**
|
|
* 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(auth()->user()->db);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|