I modified a column so it will get its value from an relation
The existing column will get a new value
The column remained unchanged
I can add colums, with normal values or values from relations.
I cannot modify or remove existing columns in the show view.
PHP 7.4.3 (cli) (built: Feb 20 2020 21:53:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
mysql Ver 15.1 Distrib 10.4.12-MariaDB, for debian-linux-gnu (x86_64) using rea
dline 5.2
When I run php artisan backpack:version the output is:
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
v7.3.0@36d8958b5b8058ef0641806e490f91102fdea70d
Hello there! Thanks for opening your first issue on this repo!
Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.
Backpack communication channels:
backpack-for-laravel tag;Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.
Thank you!
--
Justin Case
The Backpack Robot
Okay, i found a workaround.
In setupShowDefaults() i had to set the operationsetting setFromDb to false:
$this->crud->setOperationSetting('setFromDb', false);
Then in setupShowOperation, re-set it with:
$this->crud->setFromDb();
After that, i could remove/modify the colums.
Thanks for sharing your solution, @categoryshell . Note that if you want that behaviour for all CRUDs, you can add that setting to your config/backpack/crud.php file:
'operations' => [
/*
* Show Operation
*/
'show' => [
// Define the size/looks of the content div for all CRUDs
// To override per Controller use $this->crud->setShowContentClass('class-string')
'contentClass' => 'col-md-8',
+
+ // Should the Show operation try to add all columns using setFromDb()?
+ 'setFromDb' => false,
],
I found a problem related to this.
If you include 'model' => in modify/add column on setupShowOperation then ignores the modification.
Removed 'model' attribute on modifyColumn/addColumn and its show the name instead id of relationship.
Most helpful comment
Okay, i found a workaround.
In
setupShowDefaults()i had to set the operationsetting setFromDb to false:Then in setupShowOperation, re-set it with:
After that, i could remove/modify the colums.