Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

Extra requirements in the system #701

Closed backpack-operations closed 11 months ago

backpack-operations commented 12 months ago

Hello team i just received this on email: "Hi

First thanks for backpack – was asking chat gpt about help to code faster and it recommended Backpack

I have gone through some of your online material and looks interesting. Have project and will potentially give it a go

Have one question that I need to see if it can be sorted with backpack or else how can it be sorted

As my background is information security, I do have some extra requirements in the system that help my users have their mind at rest that the information is the system is not altered. To do this, I normally digital sign every record. The list of items is designed to display records that have been tempered with a colored border. Have not found any documentation on how I can add an extra value that is hidden during creation and editing of records and could not find any documentation how to extend your functionality with additional functionality.

Thanks and Regards"

pxpm commented 12 months ago

Hey @backpack-operations

You can go in many different ways, but for most of the stuff, just adding a field type=>'hidden' with your value => 'my-hidden-value' would be enough. But that leaves the door open for someone to mess with that field html and submit a different value.

In your particular case I would go with model events: https://laravel.com/docs/10.x/eloquent#events

Let me know if that's what you were looking for.

Cheers

jcastroa87 commented 11 months ago

Hello @backpack-operations

Please let us know if this information helps you, in case we do not get news from you we will close the issue but you are free to open it again.

Thank you.

jcastroa87 commented 11 months ago

Hello @backpack-operations, we will close this case due to non-activity, if you need it you can reopen it or if it is a different topic, generate a new one.

Cheers

exorgroup commented 11 months ago

Hey @backpack-operations

You can go in many different ways, but for most of the stuff, just adding a field type=>'hidden' with your value => 'my-hidden-value' would be enough. But that leaves the door open for someone to mess with that field html and submit a different value.

In your particular case I would go with model events: https://laravel.com/docs/10.x/eloquent#events

Let me know if that's what you were looking for.

Cheers

I have requested the help originally

I have opted to use the eloquent events and it works - I used the the saving event and it is exactly what I needed for that part

Now I have another issue related to same problem -

I need on the list of items check the values in database against the hash value and indicate any if the recorded hash matches the hash of the data - if it matches an svg image is shown and if not another svg image is shown

My idea was to use a custom column but have some difficulties in that as one table my have 3 columns and another may have 10 whilst another may have 7 and do not want to create a custom column for each screen that I have to perform the same function

Could do with placing everything in an array and than go through the array in the function but do not know how I can get the data (all columns values) in an array and passed to the function evaluated there and the right svg image displayed