General Error with laravel General error: 1366 Incorrect integer value: for column image_id

i’m not sure what is wrong
“message”: “SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ‘C:UsersromanAppDataLocalTempphp85A7.tmp’ for column ‘image_id’ at row 1 (SQL: insert into foods (name, description, price, offer_price, quantity, image_id, updated_at, created_at) values (Hussain Wael, kasdhv;loasid, 100, 1, 12, C:UsersromanAppDataLocalTempphp85A7.tmp, 2022-10-26 22:25:30, 2022-10-26 22:25:30))”,

store function

public function store(FoodRequest $request)
$data = Food::create($request->all());

if ($file = $request->file('image_id')) {
$path = $file->store('image');

$data['image_id'] = Image::create([
'name' => $file->getClientOriginalName(),
'size' => $file->getSize(),
'path' => $path
return $this->response_api(true, __('front.success'), StatusCodes::OK);

my migration

 Schema::create('foods', function (Blueprint $table) {

$table->float('price' , 10 , 2)->default(1);

My request :

public function rules()
return [
'image_id' => 'required_unless:_method,PUT|nullable|image',
'category_id' =>[ 'nullable','exists:categories,id',],
'menu_id' =>[ 'nullable','exists:menus,id',],
'description' =>[ 'nullable',],
'addons' =>[ 'nullable'],


Model :

class Food extends Model


 protected $fillable = [

Relations with images table:

 public function image()
return $this->belongsTo(Image::class)->withDefault();

Schema::create('images', function (Blueprint $table) {

from Newest questions tagged laravel-5 – Stack Overflow

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.