after running
php artisan routes
I get
+--------+---------------------------------------+----------------------+--------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+---------------------------------------+----------------------+--------------------------------+----------------+---------------+
| | GET /users | users.index | UsersController@index | | |
| | GET /users/create | users.create | UsersController@create | | |
| | POST /users | users.store | UsersController@store | | |
| | GET /users/{users} | users.show | UsersController@show | | |
| | GET /users/{users}/edit | users.edit | UsersController@edit | | |
| | PUT /users/{users} | users.update | UsersController@update | | |
| | PATCH /users/{users} | | UsersController@update | | |
| | DELETE /users/{users} | users.destroy | UsersController@destroy | | |
+--------+---------------------------------------+----------------------+--------------------------------+----------------+---------------+
and my backbone model is
App.Models.User = Backbone.Model.extend({
idAttribute : '_id',
url : '/users',
validate: function(attrs){
//Do some Validation
}
});
The problem was in my model...
I had the url property set to
url: '/users'
while saving the model I had to do
App.user.save({
'email' : this.$('form').find('#email').val(),
'name' : this.$('form').find('#name').val(),
'password' : this.$('form').find('#password').val()
}, { url: '/users/' + App.user.get('_id') });
and specify the url for the PUT request
Try putting this line in to your backbone script
Backbone.emulateHTTP = true
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community