laravel-schematics
laravel-schematics copied to clipboard
Table prefix issue
The table name returned by $model->getTable()
is unprefixed, causing errors on the describe
query if a table prefix is present.
https://github.com/mtolhuys/laravel-schematics/blob/c69a2e85687443c691ed8bd79d88d2f61eafc0b1/src/Http/Controllers/ModelsController.php#L59
https://github.com/mtolhuys/laravel-schematics/blob/c69a2e85687443c691ed8bd79d88d2f61eafc0b1/src/Http/Controllers/ModelsController.php#L60
This could be solved by adding the prefix manually:
$safeTableName = \DB::getQueryGrammar()->wrap($model->getConnection()->getTablePrefix() . $table);
I had this issue occur on an older Laravel version: 5.7
Not tested on anything newer.
Hi @SabatinoMasala,
Thnx for the suggestion! I'll try it out in my environments and take it along with the next release.