As it turns out, it's just not possible. You need the full definition if you want to do anything more than the basic relation functionality.
Laravel & Ardent - orderBy in $relationsData
質問
In Eloquent, you can do this:
public function children() {
return $this->hasMany('page');
}
And in Ardent, you can do this:
public static $relationsData = [
'children' => [self::HAS_MANY, 'Page'],
];
In Eloquent, you can also do this:
public function children() {
return $this->hasMany('page')->orderBy('sort_order', 'desc');
}
Is there any way to do that, or get the same effect as that in Ardent?
I really like the short Ardent notation, but don't want to have to call $page->children->ordered()
with a scope just to order them, as they'll need to be ordered every single time it's called anyway.
解決
所属していません StackOverflow