Crud: Laravel backpack Customized fields are not working for Edit and Update methods

Created on 24 Jun 2019  路  2Comments  路  Source: Laravel-Backpack/CRUD

I'm using backpack in my project. I鈥檝e created a customized fields that is dropdown and select box. In one blade file I鈥檓 displaying two fields based on dropdown selection I鈥檒l display the options for select box. So everything is working fine somehow Edit and update is working for these customized field. any idea how to achieve this? Thanks in advance

In one blade file I've written these two customized fields code. so based on dropdown selection I'll pull up the options for next select box. Tried to override existed backpack files for this model. but no luck.

'label' => "Professors", 'type' => "selectProfessors", 'name' => 'professor_id', 'entity' => 'professor', 'attribute' => "name", 'model' => Professor::class, 'options' => (function ($query) { return $query->where('professor_id', '=', backpack_user() ->professor_id) ->get(); }),
It is not working only for edit and update. for creating and deleting working as expected.

triage

Most helpful comment

Hi guys,

My 2 cents: 9 times out of 10, when stuff don't work in edit/update, it's because of the name attribute on the inputs (maybe two inputs with the same name, maybe wrong name), or the attributes not being in fillable on the model. I suggest you double-check those first.

Hope it helps.
Cheers!

All 2 comments

We might need some more info on this.

How is your field defined? What error you get? What you expect to happen and is not happening ?

Closing this as it's not a real bug report, just some general question.

You better asking this kind of stuff on the gitter channel

If you still feel this is a bug withing backpack system, please open a new bug report, but answer the questions in bug reporting template so we can better understand your issues.

Best Regards,
Pedro

Hi guys,

My 2 cents: 9 times out of 10, when stuff don't work in edit/update, it's because of the name attribute on the inputs (maybe two inputs with the same name, maybe wrong name), or the attributes not being in fillable on the model. I suggest you double-check those first.

Hope it helps.
Cheers!

Was this page helpful?
0 / 5 - 0 ratings