-
-
Notifications
You must be signed in to change notification settings - Fork 0
Relations
mbroersen edited this page Oct 15, 2020
·
1 revision
Should be added to the class field list. The relations add helper getter and setters on the parent class of the relation
- BelongsTo
- HasMany
- HasManyThrough
- HasOne
- MorphOne
Class User extends Model {
constructor() {
const fields = [
new BelongsTo(Team)
];
super(fields);
}
}import {BelongsTo} from 'jeloquent';new BelongsTo(team);import {HasMany} from 'jeloquent';new HasMany(User);import {HasManyThrough} from 'jeloquent';new HasMany(Comment, User);import {HasOne} from 'jeloquent';new HasOne(User);import {MorphOne} from 'jeloquent';new MorphOne(Avatar)