It's possible to change connection ?
franciscoarnaldog opened this issue · comments
franzag commented
Summary of problem or feature request
It's possible to change connection ?
Code snippet of problem
// $query = Model::from('model as m')
$builder = Model::query();
$builder->from('model as m')
...
$query = $builder->getQuery();
$conn = DB::connection('other_db');
$query->connection = $conn;
$query->grammar = $conn->query()->getGrammar();
$query->processor = $conn->query()->getProcessor();
$builder = $builder->setQuery($query);
return Datatables::of($builder)
...
->toJson();
System details
Laravel on Linux
- Linux Mint 21
- PHP 8.0
- Laravel 9
- Laravel-Datatables 10
Arjay Angeles commented
I think this is out of scope. Anyways, are you trying some multitenant stuff? You can change the model connection via middleware
github-actions commented
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
github-actions commented
This issue was closed because it has been inactive for 7 days since being marked as stale.