laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

Upload multipleImage erroe

Open MohamedUnis opened this issue 2 years ago • 1 comments

  • Laravel Version:8.83.2
  • PHP Version:8.0.15
  • Laravel-admin: ^1.8

Description:

I,m trying to upload multiple images $form->multipleImage('pictures')->removable()->sortable(); I modified my model : public function getPicturesAttribute($pictures) { if (is_string($pictures)) { return json_decode($pictures, true); }

    return $pictures;
}

public function setPicturesAttribute($pictures)
{
    if (is_array($pictures)) {
        $this->attributes['pictures'] = json_encode($pictures);
    }
}

I have this error : QueryException In D:\php8\htdocs\genni\vendor\laravel\framework\src\Illuminate\Database\Connection.php line 712 : SQLSTATE[HY000]: General error: 1364 Field 'pictures' doesn't have a default value

Steps To Reproduce:

Capture

MohamedUnis avatar Mar 07 '22 08:03 MohamedUnis

that's table column default value problem, please set pictures allow null in table.

Yanghsuanming avatar Mar 09 '22 15:03 Yanghsuanming