Skip to content
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

В Laravel 11 displayAppend не работает, как описано в примере #2851

Open
vserdobintsev opened this issue Jul 9, 2024 · 2 comments

Comments

@vserdobintsev
Copy link

          Example:
declare(strict_types=1);

namespace App;

use Orchid\Platform\Models\User as Authenticatable;

class User extends Authenticatable
{
    /**
     * @return string
     */
    public function getFullAttribute(): string
    {
        return $this->attributes['name'] . ' (' . $this->attributes['email'] . ')';
    }
}

Usage:

Relation::make('users.')
    ->fromModel(User::class, 'name')
    ->displayAppend('full')
    ->multiple();

Screenshot:
image

Originally posted by @tabuna in #877 (comment)

@vserdobintsev
Copy link
Author

Аксессоры, к тому-же, теперь иначе описываются: https://laravel.com/docs/11.x/eloquent-mutators#defining-an-accessor

@vserdobintsev
Copy link
Author

При вызове displayAppend и передаче ему имени аксессора, отображается то, что указывалось во втором аргументе fromModel. Единственное как работает displayAppend: указание альтернативного атрибута модели.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant