Laravel-Backpack / devtools-issues

Bug reports and feature requests for our closed-source DevTools package
4 stars 1 forks source link

[Bug] can not generate a foreignId-type column in Laravel 11 #74

Closed fzhantw closed 6 months ago

fzhantw commented 7 months ago

Bug report

What I did

  1. Add a column which "Column Type" is "BelongsTo". on path "admin/devtools/model/create"
  2. Press "save"
  3. Error happened

What I expected to happen

Generate model & crud

What happened

error occur as below:
[2024-04-29 17:23:52] local.ERROR: Call to a member function getName() on string {"userId":1,"exception":"[object] (Error(code: 0): Call to a member function getName() on string at /Users/fzhan/Herd/yongchieh/vendor/backpack/devtools/src/Generators/BlueprintGenerator.php:389)
[stacktrace]
#0 [internal function]: Backpack\\DevTools\\Generators\\BlueprintGenerator->Backpack\\DevTools\\Generators\\{closure}('page_metas', '\\x00Backpack\\\\CRUD\\\\...')

What I've already tried to fix it

Try to add a connection name attribute on relation model, but it was not helping.

Backpack, Laravel, PHP, DB version

Laravel 11.5

PHP 8.2.16

DB MySQL 8.2.0

When I run php artisan backpack:version the output is:

backpack/activity-log: 2.0.4
backpack/basset: 1.3.3
backpack/crud: 6.7.11
backpack/devtools: 3.1.3
backpack/editable-columns: 3.0.9
backpack/generators: v4.0.5
backpack/logmanager: v5.0.1
backpack/medialibrary-uploaders: 1.2.0
backpack/pagemanager: 3.3.0
backpack/permissionmanager: 7.2.1
backpack/pro: 2.1.13
backpack/settings: 3.1.1
backpack/theme-tabler: 1.2.10
backpack/translation-manager: 1.0.3

Operating System and Server Setup

MacOS(M1) Server setup by Herd

karandatwani92 commented 7 months ago

Hey @pxpm please check this. When i tried, i received different error.

mfaoficial commented 7 months ago

When i tried i received the same error as @karandatwani92

pxpm commented 6 months ago

Thanks @fzhantw @mfaoficial and @karandatwani92 .

I was able to reproduce both errors and fixed them in 3.1.5.

Our private repository should pick the new version in a few moments and you will be able to get the fixed version with a composer update.

Let me know if you still experiencing the issue 🙏

Cheers

fzhantw commented 6 months ago

@pxpm works fine in 3.1.5. thanks