DutchPrince
DutchPrince

Reputation: 363

Laravel not storing specific form data in database without giving an error

I am storing form input in laravel, and almost everything works fine the other form inputs are correctly stored but not my color codes.

The names are correct otherwise i would get an error while updating and storing. Here is what i have.

laravel db table columns

 $table->string('color_code_1')->default('#006661');
 $table->string('color_code_2')->default('#006661');
 $table->string('color_code_3')->default('#006661');

form values send to api

 color_code_1: #006661
 color_code_2: #006664
 color_code_3: #006661

Controller storing values

public function update(Request $request, $id)
{
    $input = $request->all();

    $user->cases()->whereId($id)->first()->update($input);

    return redirect('/admin/cases');
}

This is working fine for all my other values but these three values just wont change in the db.

Maybe it has something to do with their hex values but i couldnt figure it out.

Does someone have an idea? Thanks in advance!

Upvotes: 0

Views: 373

Answers (1)

DutchPrince
DutchPrince

Reputation: 363

Solution edit the fillable in my model

   protected $fillable = [
        'color_code_1',
        'color_code_2',
        'color_code_3',
      ];

Upvotes: 1

Related Questions