Tuesday, May 23, 2017

Stop all fillable items trying to save to database laravel

I have a form with some items firstname, surname, checkbox

In my model I have

$fillable = [firstname, surname, checkbox]

$appends = [checkbox]

In my database only contains firstname and surname

The purpose of the checkbox is to signal something post saving in an observer.

I want to use mass assignment to set all these items.

However when it comes to saving my model it tries to save checkbox in the database.

How to get over this?

I dont want to singularly assign it with $model->checkbox = Input::get('checkbox') as I will eventually have lots of different items.



via George Hallam

Advertisement