|
Hello! Thank you for wonderful product! My question is: For example: export default class Operator extends Model {
@HasMany(() => Ticket, "operator_id") declare tickets: Ticket[];
get ticket_count() {
return this.tickets?.length;
}
}
P.S. If I understand correctly, models are dumb and cannot be used for querying the data. const sortedOperators = computed(() => {
return operatorRepo.value
.with("tickets")
.orderBy("ticket_count", "desc")
.get();
});But this works: const sortedOperators = computed(() => {
return useCollect(
operatorRepo.value.with("tickets").get()
).sortBy([["ticket_count", "desc"]]);
});Am I doing it the right way? |
Answered by
CodeDredd
Jan 22, 2023
Replies: 1 comment
|
Yes you are doing it the right way. Also in |
0 replies
Answer selected by
daniser
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes you are doing it the right way. Also in
vuex-ornyou never could access relations because they are loaded to late. Maybe i try for v2. make this possible, but first i have to look into the code what this would mean.