Laravel eloquent updating tinyint (boolean)
eloquent, laravel, laravel-5, php
Solution
If `$request->active` returns true, but it still doesn't save in DB, I bet you forgot to add `active` to a `$fillable` array:
protected $fillable = ['something', 'something_else', 'active'];
https://laravel.com/docs/5.3/eloquent#mass-assignment
Problem
I have a weird issue when updating eloquent model, I use a checkbox (1 || undefined ) and patch all the data after validation using ``` $input = $request->all(); $service->update($input); ``` I tried to check the checkbox specifically ``` $input['active'] = ($request->has('active') && $input['active']) ? 1 : 0 ``` but it still wouldn't affect the database. When I dump the `Request` I can see `active:` `1` or `0` but nothing of that changes the database on `update()` I did a quick testing and using ``` $service->active = ($request->has('active') && $input['active']) ? 1 : 0 ; $service->save(); ``` did the job. But why the `update()` isn't updating this field ?