[Bug] Relationship field broken - underscore in field name
See original GitHub issueBug report
Relationship field seems broken if you have an underscore in the name of the field.
What I did
$this->crud->addFields([
[
'label' => 'Billing address',
'type' => "relationship",
'name' => 'billing_address',
'attribute' => 'full_address',
'ajax' => true,
'inline_create' => [
'entity' => 'address',
'force_select' => true,
'modal_class' => 'modal-dialog modal-xl',
]
],
]);
What I expected to happen
A good route generated : /site/fetch/billing_address
What happened
A bad route has been generated : /site/fetch/billing-address
Backpack, Laravel, PHP, DB version
When I run php artisan backpack:version
the output is:
PHP VERSION:
PHP 7.2.19 (cli) (built: May 29 2019 13:58:59) ( ZTS MSVC15 (Visual C++ 2017) x64 ) Copyright © 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
LARAVEL VERSION:
v7.10.3@6e927e78aafd578d59c99608e7f0e23a5f7bfc5a
BACKPACK VERSION:
4.1.3@02988a0d14b09e55949781d729060df910f0d94b
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Field name with a leading underscore in Model - Stack Overflow
Yes, it's ok. Yes, in QuerySets you should use them with leading underscore: A.objects.filter(_number__in=(1,2,3)).count().
Read more >"Invalid field name: [1st_XXXXX_XXX]. The first character must ...
Field names must contain only alphanumeric or underscore characters. Spaces are not allowed. Field names cannot start with a number. Each field ......
Read more >SQL Server Naming Standards
Rule 2g (Special Characters) – Field names should contain only letters and numbers. No special characters, underscores or spaces should be used. 3....
Read more >Custom Field Types - Salesforce Help
When you have data that doesn't match any of the standard fields, your administrator can create a custom field for that data. For...
Read more >How to write SQL queries with spaces in column names
To fix this error, we can specify the table name in the Square bracket.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, managed to get it working this way : (still don’t know why it works this way)
Fixed by #2905 so let’s move the conversation there please. Thanks a lot for raising the issue @dividy ! Very good collaboration between you and @pxpm here I see.