mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 15:43:59 +08:00
Simplify model registration
This commit is contained in:
parent
d4e8276b3f
commit
ba5b79451b
|
@ -9,10 +9,10 @@ import Notification from 'flarum/models/notification';
|
|||
export default function(app) {
|
||||
app.store = new Store();
|
||||
|
||||
app.store.model('users', User);
|
||||
app.store.model('discussions', Discussion);
|
||||
app.store.model('posts', Post);
|
||||
app.store.model('groups', Group);
|
||||
app.store.model('activity', Activity);
|
||||
app.store.model('notifications', Notification);
|
||||
app.store.models['users'] = User;
|
||||
app.store.models['discussions'] = Discussion;
|
||||
app.store.models['posts'] = Post;
|
||||
app.store.models['groups'] = Group;
|
||||
app.store.models['activity'] = Activity;
|
||||
app.store.models['notifications'] = Notification;
|
||||
};
|
||||
|
|
|
@ -55,10 +55,6 @@ export default class Store {
|
|||
return data ? Object.keys(data).map(id => data[id]) : [];
|
||||
}
|
||||
|
||||
model(type, Model) {
|
||||
this.models[type] = Model;
|
||||
}
|
||||
|
||||
createRecord(type, data) {
|
||||
data = data || {};
|
||||
data.type = data.type || type;
|
||||
|
|
Loading…
Reference in New Issue
Block a user