Laravel-Backpack / NewsCRUD

An admin panel for news with categories and tags, using Backpack CRUD on Laravel 10
http://backpackforlaravel.com
Other
233 stars 51 forks source link

Article Status won't get updated #63

Closed dahdash closed 2 years ago

dahdash commented 2 years ago

Bug report

If Article Status changes to 'DRAFT', it won't get updated.

What happened:

The Status field in form pass 0 and 1 to enum entity and it always update the field to default value for enum (PUBLISHED).

What I've already tried to fix it:

Change Status field type from select_from_array to enum would solve the issue: $this->crud->addField([ 'name' => 'status', 'label' => 'Status', 'type' => 'enum', ]);

Backpack, Laravel, PHP, DB version:

Backpack 5.0.18, Laravel 9.13, PHP 8.1.6, mysql Ver 15.1 Distrib 10.7.3-MariaDB

welcome[bot] commented 2 years ago

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 mediums:

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

tabacitu commented 2 years ago

Good catch @dahdash - thanks for taking the time to see WHY this doesn't work, and explain it.

Changing the field to enum works, yes, but we wanted to use select_from_array here so that it also works on non-MySQL databases. So I've changed the options of select_from_array instead. After https://github.com/Laravel-Backpack/NewsCRUD/pull/64 it should all work fine - please let us know if it doesn't.

Thanks again. Cheers!