Closed jdsingh closed 9 years ago
I can say the same thing: using sqlite (with default PDO and driver), update method does not acctualy affect data in the DB.
I'm using the "dev" version of the package, from packagist.
I didn't try update with this package, but I wasn't seeing the results either when doing it from straight Elequent on MySQL. Might be related.
It could be. I've spent some time fixing the bug, however i wasn't able to solve the problem, either with some errorproof code for laravel 4.2/5.0. Maybe some bug introduced in recent laravel/symfony? Il 11/mag/2015 18:46, "Stuart Hannig" notifications@github.com ha scritto:
I didn't try update with this package, but I wasn't seeing the results either when doing it from straight Elequent on MySQL. Might be related.
— Reply to this email directly or view it on GitHub https://github.com/Bosnadev/Repositories/issues/27#issuecomment-100975405 .
My problem is it is trying to update _method and _token in the DB since those are in the request object. Its not taking into account only the model's fields. Anyone also run into this issue?
@robertvrabel Did you try $request->except('_method', '_token')
?
@jdsingh Yeah i did. I can get it to work doing that, but it seems like unnecessary overhead? I'd hate to have that lingering all over the place.
@robertvrabel yeah that looks bit dirty, it should work with model's fill-able property but still yours work with that.
I have to use this
$model = $this->model->find($id);
$model->update($request->all());
Got it working by specifying the primary key $attribute as mongodb uses "_id" as primary key.
$this->user->update($request->all(), $id, "_id");
I'm using mongoDB as database and https://github.com/jenssegers/laravel-mongodb package.
When I run this code
$this->user->update($request->all(), $id);
, it executes fine but the data is not being updated in database.Version info "laravel/framework": "5.0.*", "jenssegers/mongodb": "~2.1",