-
-
Notifications
You must be signed in to change notification settings - Fork 659
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
Ability to use appends fields in Relation field #877
Comments
This field is computed. Accordingly, we can not implement a really optimal sql query. Relation::make('categories')
->multiple()
->title(__('Categories'))
->fromModel(Category::class, 'title')
->displayAppend('nested_title'), This will not be a clean solution, but will output what you want. |
I added a rough solution, but I think it requires some discussion and testing. |
Maybe something like this works too?
|
In such processing, the anonymous function will have to be executed on Ajax request, and there is a logical question - how to pass it. |
Such a decision has already completely entered the system and is now not planning to change. It is necessary to document this |
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(); |
This is published in 6.7.0 |
Hello, I'm wondering if this feature also available for |
Hi @tabuna please is there a way to "paginate" fromModel? E.g. I have this code:
but it returns only first chunk of searched products and I can not find any other option than is in the first chunk. thanks. |
Expected Behavior
It should return nested_title which appends to the model Category
Actual Behavior
Relation endpoint returning 500 error
Specifications
The text was updated successfully, but these errors were encountered: