-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Advanced use case issue for column type text #5645
Comments
Hello @mialex I don't get where Thanks |
Hey @pxpm He came up with Anyway, I was able to reproduce the BUG. Here's how it goes:
protected function name(): Attribute
{
return Attribute::make(
get: fn(string $value) => ucfirst($value),
set: fn(string $value) => strtolower($value),
);
} |
Thanks @mialex for the report. Exceptional work @karandatwani92 it helped a lot to just know where too look at 👍 This had been fixed in the latest Cheers |
Yes, sorry, I copied wrong original column |
Bug report
For columns type
text
we can use 1-to-1 relation.In my case I have a user model with the
email
field. For the email field, I have a mutatorWhat I expected to happen
I would expect to get my email value when I show the column
What happened
Instead, I get an error
Call to undefined method ...Models\User::email()
What I've already tried to fix it
The issue is here
Particularly in tuis, please
if (! method_exists($model, $lastSegmentAfterDot)) {
I would say that you need to use reflection to define is this is the Attribute method or no.
See: https://laravel.com/docs/11.x/eloquent-mutators#defining-a-mutator
Backpack, Laravel, PHP, DB version
PHP VERSION:
8.3.10
PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, hash, iconv, json, mbstring, SPL, session, PDO, pdo_sqlite, bz2, posix, random, readline, Reflection, standard, SimpleXML, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, amqp, apcu, bcmath, Phar, calendar, exif, gd, gettext, intl, mysqli, pcntl, pdo_mysql, redis, shmop, soap, sockets, sodium, sysvmsg, sysvsem, sysvshm, xsl, zip, Zend OPcache, xdebug
LARAVEL VERSION:
11.21.0.0
BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.6
backpack/crud: 6.7.33
backpack/generators: v4.0.5
backpack/menucrud: v4.0.1
backpack/pagemanager: 3.3.0
backpack/permissionmanager: 7.2.1
backpack/settings: 3.1.1
backpack/theme-coreuiv4: 1.1.2
The text was updated successfully, but these errors were encountered: