plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: connection field in model is ignored

Open BerendSpigt opened this issue 1 year ago • 3 comments

Bug description

My model looks like this:

class ClientString extends Model
{
    protected $connection = 'localization';
}

All other models use the default connection (DB_CONNECTION), but this model uses an external db (defined in the database config). This is supported in Laravel and works perfectly.

I don't use migrations, so I use "Fetch data from connection".

But when I generate the helper code, I get: Table not found for App\Models\ClientString (strings)

It seems the plugin does not respect the connection setting in the model.

Plugin version

8.1.3.233

Operating system

MacOS

Steps to reproduce

No response

Relevant log output

No response

BerendSpigt avatar Mar 25 '24 23:03 BerendSpigt

I'm a little surprised there is no reaction to this one as it seems to be a basic feature that should work, and the problem is perfectly reproducible, and the fix should be fairly easy.

BerendSpigt avatar May 03 '24 10:05 BerendSpigt

Hello. Sorry for the long response. Have you tried adding this connection(you can set up multiple connections there) in the Helper Code Parameters window? main menu > Laravel > Helper Code Parameters...

adelf avatar May 03 '24 16:05 adelf

Thanks, that worked! I think I previously did not realise this is a multi-select box.

BerendSpigt avatar May 03 '24 20:05 BerendSpigt