I have a problem with one of my controllers either in Laravel or Ember. I can get the record to save after filling out the form but the record will not persist to the database. Again the form saves the record but doesn't push the record to the database. I tried following Embers guides on pushing data to the server but no juice. Also thanks for all the help from this site, you have got me this far, hopefully I can get this worked out with your help. Here are the controllers,
//Laravel Controller
$statusCode = 200;
$libraries = $request->all();
$library = Library::create($libraries);
$criteria = $library->toArray();
return Response::json([
'libraries' => $criteria],
$statusCode);
//Ember Controller
model() {
return this.store.createRecord('library');
},
actions: {
saveLibrary(item) {
item.save().then(() => this.transitionTo('libraries'));
},
willTransition() {
//rollbackAttributes() removes the record from the store
// if model is 'isNew'
this.controller.set('model').rollbackAttributes();
}
}
Aucun commentaire:
Enregistrer un commentaire