rycks/laravel-dolibarr

Database prefix

Opened this issue · 2 comments

The problem arises when attempting to use the Caprel\Dolibarr package in conjunction with a custom database prefix. Despite setting the desired prefix in the package's configuration, it appears that an additional "dolibarr" prefix is being appended to the table names. This causes conflicts when interacting with the database, as the package expects table names with the "llxnm_" prefix, rather than "llxnm_dolibarr_".

As a result, any queries or operations performed by the package fail to locate the corresponding tables due to the mismatched prefixes. This issue impedes the seamless integration of the Caprel\Dolibarr package within Laravel applications that rely on custom database prefixes.

I have reviewed the package documentation and attempted to modify the prefix using the available configuration options, but unfortunately, these steps did not resolve the problem. Additionally, I explored alternative approaches, such as extending the package's classes and directly modifying the code, but these workarounds did not provide a satisfactory solution either.

I am reaching out to you to seek guidance and assistance in resolving this matter. It would be greatly appreciated if you could review the issue and provide any insights or suggestions on how to address this conflict effectively. If there are any modifications or updates that can be made to the package to support customization of the database prefix, it would greatly benefit users who rely on Laravel with custom database prefixes.

I am more than willing to provide any additional details, error messages, or code snippets that could assist you in investigating this issue further. Please let me know if there are any specific steps or tests I can perform to help diagnose the problem and work towards a resolution.

Thank you for your attention to this matter, and I look forward to your response. Your expertise and support in resolving this issue would be immensely valuable.

I've solved the problem adding to the user model

protected $table = 'user';

rycks commented

Good morning @kreativitat,
I think there is a big misunderstanding on the fundamentals of this module...

This module is not made to connect directly to the dolibarr database but to the dolibarr RESTfull API...

So do not try to add anything as a prefix or other stuff: it is totally invisible at the level of the laravel application since you connect to the dolibarr API and it is therefore the dolibarr API that is loads 'locally' to use its prefix which is not at all visible/known/communicated to the laravel application...