Laravel-Backpack / community-forum

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

[Bug] afterField() doesn't seem to do anything #1020

Closed prescriptionlifeline closed 3 weeks ago

prescriptionlifeline commented 3 weeks ago

Bug report

What I did

In my database table I have, among other columns, note and uniformAgreement, in that order. I want to make it so that in the CRUD HTML notes appears after uniformAgreement even tho, in the DB, it appears before.

To that end I tried this:

CRUD::field(['name' => 'notes'])->afterField('uniformAgreement');

What I expected to happen

I expected the Notes field to appear after the uniform agreement.

What happened

The Notes field is appearing before the uniform agreement field:

Screenshot 2024-06-09 131810

What I've already tried to fix it

I tried afterField. Not sure what else I can try.

Is it a bug in the latest version of Backpack?

Yes

After I run composer update backpack/crud the bug... is it still there?

Yes.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
8.1.2-1ubuntu2.17

### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache

### LARAVEL VERSION:
10.43.0.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.4
backpack/crud: 6.7.15
backpack/filemanager: 3.0.7
backpack/generators: v4.0.3
backpack/pro: 2.1.8
backpack/theme-tabler: 1.2.5
jcastroa87 commented 3 weeks ago

Hello @prescriptionlifeline

Can you try this:

CRUD::field(['name' => 'notes'])->after('uniformAgreement');

Let me know if thats work for you.

Cheers.

prescriptionlifeline commented 3 weeks ago

That worked - thanks!